METRICS_TABLES

The METRICS_TABLES table provides the PromQL (Prometheus Query Language) definition for each of the views in the METRICS_SCHEMA database.

METRICS_TABLES - 图1

Note

This table is only applicable to TiDB Self-Hosted and not available on TiDB Cloud.

  1. USE INFORMATION_SCHEMA;
  2. DESC METRICS_TABLES;

The output is as follows:

  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. +------------+--------------+------+------+---------+-------+

Field description:

  • TABLE_NAME: Corresponds to the table name in METRICS_SCHEMA.
  • PROMQL: The working principle of the monitoring table is to map SQL statements to PromQL and convert Prometheus results into SQL query results. This field is the expression template of PromQL. When you query the data of the monitoring table, the query conditions are used to rewrite the variables in this template to generate the final query expression.
  • LABELS: The label for the monitoring item. Each label corresponds to a column in the monitoring table. If the SQL statement contains the filter of the corresponding column, the corresponding PromQL changes accordingly.
  • QUANTILE: The percentile. For monitoring data of the histogram type, a default percentile is specified. If the value of this field is 0, it means that the monitoring item corresponding to the monitoring table is not a histogram.
  • COMMENT: The comment about the monitoring table.
  1. SELECT * FROM metrics_tables LIMIT 5\G

The output is as follows:

  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)