Custom mysql query problem

reference: https://github.com/Percona-Lab/pmm-custom-queries/blob/master/mysql/innodb-index-stats.yml
only get mysql_innodb_index_stats_leaf_pages_size_bytes metrics and can’t get mysql_innodb_index_stats_size_bytes metrics.
QQ截图20210107165051
when i change the first mysql_innodb_index_stats name to another,such as mysql_innodb_index_stats1, it’s ok.
QQ截图20210107163039

the prefix mysql_innodb_index_stats cannot be the same?

pmm-admin version:

ProjectName: pmm-admin
Version: 2.12.0
PMMVersion: 2.12.0
Timestamp: 2020-12-01 11:57:04 (UTC)
FullCommit: e81fe912b1029095f310945f831abc71c824e139

mysql_innodb_index_stats:
query: “select database_name as schema_name,table_name,index_name,stat_value*@@innodb_page_size as size_bytes from mysql.innodb_index_stats where stat_name=‘size’;”
metrics:
- table_name:
usage: “LABEL”
description: “Table name”
- size_bytes:
usage: “GAUGE”
description: “Index Size in Bytes”
- schema_name:
usage: “LABEL”
description: “Schema Name”
- index_name:
usage: “LABEL”
description: “Index name”
mysql_innodb_index_stats:
query: “select database_name as schema_name,table_name,index_name,stat_value*@@innodb_page_size as leaf_pages_size_bytes from mysql.innodb_index_stats where stat_name=‘n_leaf_pages’;”
metrics:
- table_name:
usage: “LABEL”
description: “Table name”
- leaf_pages_size_bytes:
usage: “GAUGE”
description: “Leaf Pages Size in Bytes”
- schema_name:
usage: “LABEL”
description: “Schema Name”
- index_name:
usage: “LABEL”
description: “Index name”

1 Like

Hi @huc,

Yes, prefixes have to be unique.
Please replace the second prefix by mysql_innodb_index_stats_leaf and change leaf_pages_size_bytes to pages_size_bytes in the query and description.

1 Like

ok.thanks for your reply

1 Like

The need for two prefixes and two sqls for practically the same SQL, same source of data can be easily avoided converting rows-into-columns. :slight_smile: it worked pretty good for me

1 Like