METRICS_TABLES
METRICS_TABLES 表为 metrics_schema 数据库中的每个视图提供 PromQL(Prometheus 查询语言)定义。
1. USE information_schema;
2. DESC metrics_tables;
1. +------------+--------------+------+------+---------+-------+
2. | Field | Type | Null | Key | Default | Extra |
3. +------------+--------------+------+------+---------+-------+
4. | TABLE_NAME | varchar(64) | YES | | NULL | |
5. | PROMQL | varchar(64) | YES | | NULL | |
6. | LABELS | varchar(64) | YES | | NULL | |
7. | QUANTILE | double | YES | | NULL | |
8. | COMMENT | varchar(256) | YES | | NULL | |
9. +------------+--------------+------+------+---------+-------+
表 metrics_tables 的字段解释:
TABLE_NAME:对应于metrics_schema中的表名。PROMQL:监控表的主要原理是将 SQL 映射成PromQL,并将 Prometheus 结果转换成 SQL 查询结果。这个字段是PromQL的表达式模板,查询监控表数据时使用查询条件改写模板中的变量,生成最终的查询表达式。LABELS:监控定义的 label,每一个 label 对应监控表中的一列。SQL 中如果包含对应列的过滤,对应的PromQL也会改变。QUANTILE:百分位。对于直方图类型的监控数据,指定一个默认百分位。如果值为0,表示该监控表对应的监控不是直方图。COMMENT:对这个监控表的注释。
1. SELECT * FROM metrics_tables LIMIT 5\G
1. *************************** 1. row ***************************
2. TABLE_NAME: abnormal_stores
3. PROMQL: sum(pd_cluster_status{ type=~"store_disconnected_count|store_unhealth_count|store_low_space_count|store_down_count|store_offline_count|store_tombstone_count"})
4. LABELS: instance,type
5. QUANTILE: 0
6. COMMENT:
7. *************************** 2. row ***************************
8. TABLE_NAME: etcd_disk_wal_fsync_rate
9. PROMQL: delta(etcd_disk_wal_fsync_duration_seconds_count{$LABEL_CONDITIONS}[$RANGE_DURATION])
10. LABELS: instance
11. QUANTILE: 0
12. COMMENT: The rate of writing WAL into the persistent storage
13. *************************** 3. row ***************************
14. TABLE_NAME: etcd_wal_fsync_duration
15. PROMQL: histogram_quantile($QUANTILE, sum(rate(etcd_disk_wal_fsync_duration_seconds_bucket{$LABEL_CONDITIONS}[$RANGE_DURATION])) by (le,instance))
16. LABELS: instance
17. QUANTILE: 0.99
18. COMMENT: The quantile time consumed of writing WAL into the persistent storage
19. *************************** 4. row ***************************
20. TABLE_NAME: etcd_wal_fsync_total_count
21. PROMQL: sum(increase(etcd_disk_wal_fsync_duration_seconds_count{$LABEL_CONDITIONS}[$RANGE_DURATION])) by (instance)
22. LABELS: instance
23. QUANTILE: 0
24. COMMENT: The total count of writing WAL into the persistent storage
25. *************************** 5. row ***************************
26. TABLE_NAME: etcd_wal_fsync_total_time
27. PROMQL: sum(increase(etcd_disk_wal_fsync_duration_seconds_sum{$LABEL_CONDITIONS}[$RANGE_DURATION])) by (instance)
28. LABELS: instance
29. QUANTILE: 0
30. COMMENT: The total time of writing WAL into the persistent storage
31. 5 rows in set (0.00 sec)
