INSPECTION_SUMMARY

In some scenarios, you might need to pay attention only to the monitoring summary of specific links or modules. For example, the number of threads for Coprocessor in the thread pool is configured as 8. If the CPU usage of Coprocessor reaches 750%, you can determine that a risk exists and Coprocessor might become a bottleneck in advance. However, some monitoring metrics vary greatly due to different user workloads, so it is difficult to define specific thresholds. It is important to troubleshoot issues in this scenario, so TiDB provides the inspection_summary table for link summary.

INSPECTION_SUMMARY - 图1

Note

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

The structure of the information_schema.inspection_summary inspection summary table is as follows:

  1. USE information_schema;
  2. DESC inspection_summary;
  1. +--------------+--------------+------+------+---------+-------+
  2. | Field | Type | Null | Key | Default | Extra |
  3. +--------------+--------------+------+------+---------+-------+
  4. | RULE | varchar(64) | YES | | NULL | |
  5. | INSTANCE | varchar(64) | YES | | NULL | |
  6. | METRICS_NAME | varchar(64) | YES | | NULL | |
  7. | LABEL | varchar(64) | YES | | NULL | |
  8. | QUANTILE | double | YES | | NULL | |
  9. | AVG_VALUE | double(22,6) | YES | | NULL | |
  10. | MIN_VALUE | double(22,6) | YES | | NULL | |
  11. | MAX_VALUE | double(22,6) | YES | | NULL | |
  12. | COMMENT | varchar(256) | YES | | NULL | |
  13. +--------------+--------------+------+------+---------+-------+
  14. 9 rows in set (0.00 sec)

Field description:

  • RULE: Summary rules. Because new rules are being added continuously, you can execute the select * from inspection_rules where type='summary' statement to query the latest rule list.
  • INSTANCE: The monitored instance.
  • METRICS_NAME: The monitoring metrics name.
  • QUANTILE: Takes effect on monitoring tables that contain QUANTILE. You can specify multiple percentiles by pushing down predicates. For example, you can execute select * from inspection_summary where rule='ddl' and quantile in (0.80, 0.90, 0.99, 0.999) to summarize the DDL-related monitoring metrics and query the P80/P90/P99/P999 results. AVG_VALUE, MIN_VALUE, and MAX_VALUE respectively indicate the average value, minimum value, and maximum value of the aggregation.
  • COMMENT: The comment about the corresponding monitoring metric.

INSPECTION_SUMMARY - 图2

Note

Because summarizing all results causes overhead, it is recommended to display the specific rule in the SQL predicate to reduce overhead. For example, executing select * from inspection_summary where rule in ('read-link', 'ddl') summarizes the read link and DDL-related monitoring metrics.

Usage example:

Both the diagnostic result table and the diagnostic monitoring summary table can specify the diagnostic time range using hint. select /*+ time_range('2020-03-07 12:00:00','2020-03-07 13:00:00') */* from inspection_summary is the monitoring summary for the 2020-03-07 12:00:00 to 2020-03-07 13:00:00 period. Like the monitoring summary table, you can use the inspection_summary table to quickly find the monitoring items with large differences by comparing the data of two different periods.

The following example compares the monitoring metrics of read links in two time periods:

  • (2020-01-16 16:00:54.933, 2020-01-16 16:10:54.933)
  • (2020-01-16 16:10:54.933, 2020-01-16 16:20:54.933)
  1. SELECT
  2. t1.avg_value / t2.avg_value AS ratio,
  3. t1.*,
  4. t2.*
  5. FROM
  6. (
  7. SELECT
  8. /*+ time_range("2020-01-16 16:00:54.933", "2020-01-16 16:10:54.933")*/ *
  9. FROM information_schema.inspection_summary WHERE rule='read-link'
  10. ) t1
  11. JOIN
  12. (
  13. SELECT
  14. /*+ time_range("2020-01-16 16:10:54.933", "2020-01-16 16:20:54.933")*/ *
  15. FROM information_schema.inspection_summary WHERE rule='read-link'
  16. ) t2
  17. ON t1.metrics_name = t2.metrics_name
  18. and t1.instance = t2.instance
  19. and t1.label = t2.label
  20. ORDER BY
  21. ratio DESC;