Skip to content

TiDB Cloud

Collect TiDB Cloud Metrics information

Installation and Configuration

Prerequisites

  • Install DataKit

Obtain the scrape_config File

Log in to the TiDB Cloud console, go to the Project Settings page, click on Integrations in the left-hand navigation bar of the page, then select Integration to Prometheus, click Add File to generate the Scrape_config Files file, with the following content:

scrape_configs:
  - job_name: default project
    scheme: https
    metrics_path: /public_api/v1/projects/137281308945xxxxxx/metrics
    params:
      format: ["Prometheus"]
    bearer_token: 0596ae4a875d4d09a99177797xxxxxxxx
    static_configs:
    - targets: ["tidbcloud.com"]

After adding the Scrape_config Files file, click Save to save it, and you can collect the metric data from TiDB Cloud.

DataKit Configuration

To collect metrics from TiDB Cloud, go to the conf.d/samples directory under the DataKit installation directory, and execute the following command:

cp prom.conf.sample tidbcloud.conf

Adjust the content of tidbcloud.conf, mainly adjusting the urls, as follows:

[[inputs.prom]]
  ## Exporter URLs.
  urls = ["https://tidbcloud.com/public_api/v1/projects/137281308945xxxxxx/metrics?format=Prometheus"]
  source = "tidbcloud"
  interval = "10s"

  [inputs.prom.auth]
    type = "bearer_token"
    token = "0596ae4a875d4d09a99177797xxxxxxxx"

Other configurations can be adjusted as needed, parameter adjustment description:

  • urls: The prometheus metrics address, fill in the corresponding component's exposed metrics url here.
  • source: Collector alias, recommended for differentiation.
  • interval: Collection interval.
  • token: The prometheus metrics authorization token.

Restart DataKit

Restart DataKit

Metrics

Metric Set tidbcloud

Metrics Description Type
tidbcloud_db_queries_total Count Total number of executed statements
tidbcloud_db_failed_queries_total Count Total number of execution errors
tidbcloud_db_connections Count Current number of connections to the TiDB server
tidbcloud_db_query_duration_seconds s Histogram of statement execution duration
tidbcloud_node_storage_used_bytes Bytes Number of bytes used on TiKV/TiFlash node disks
tidbcloud_node_storage_capacity_bytes Bytes Disk capacity in bytes for TiKV/TiFlash nodes
tidbcloud_node_cpu_seconds_total % CPU usage rate for TiDB/TiKV/TiFlash nodes
tidbcloud_node_cpu_capacity_cores Count Number of CPU limit cores for TiDB/TiKV/TiFlash nodes
tidbcloud_node_memory_used_bytes Bytes Number of memory bytes used by TiDB/TiKV/TiFlash nodes
tidbcloud_node_memory_capacity_bytes Bytes Memory capacity in bytes for TiDB/TiKV/TiFlash nodes

Feedback

Is this page helpful? ×