name: metadb

attributes:
  sql_type:
    description: The command types of sql statements, such as select, create, etc.
  cluster_name:
    description: Cluster name.
  cluster_id:
    description: Cluster ID.
  instance:
    description: Instance name.
  component:
    description: Components of a TiDB cluster.
    enum: [tidb, tikv, pd, tiflash]
  error_type:
    value: type
    description: Error types of query errors, such as planner:xxx, executor:2345, etc.

metrics:
  tidb_cloud.db_queries_total:
    enabled: true
    description: The total number of queries.
    unit: 1
    sum:
      value_type: int
      monotonic: true
      aggregation: cumulative
    attributes: [sql_type, cluster_name, cluster_id, instance, component]
  tidb_cloud.db_failed_queries_total:
    enabled: true
    description: The total number of execution errors.
    unit: 1
    sum:
      value_type: int
      monotonic: true
      aggregation: cumulative
    attributes: [error_type, cluster_name, cluster_id, instance, component]
  tidb_cloud.db_connections:
    enabled: true
    description: Current number of connections in TiDB server.
    unit: 1
    gauge:
      value_type: int
    attributes: [cluster_name, instance, cluster_id, component]
  tidb_cloud.db_query_duration_seconds:
    enabled: true
    description: Query duration distribution of seconds.
    unit: s
    histogram:
      aggregation: cumulative
    attributes: [sql_type, cluster_name, cluster_id, instance, component]



  tidb_cloud.node_storage_used_bytes:
    enabled: true
    description: The disk usage bytes of TiKV/TiFlash nodes.
    unit: By
    gauge:
      value_type: int
    attributes: [cluster_name, cluster_id, instance, component]
  tidb_cloud.node_storage_capacity_bytes:
    enabled: true
    description: The disk capacity bytes of TiKV/TiFlash nodes.
    unit: By
    gauge:
      value_type: int
    attributes: [cluster_name, cluster_id, instance, component]



  tidb_cloud.node_cpu_seconds_total:
    enabled: true
    description: The CPU usage of TiDB/TiKV/TiFlash nodes.
    unit: s
    sum:
      value_type: int
      monotonic: true
      aggregation: cumulative
    attributes: [cluster_name, cluster_id, instance, component]
  tidb_cloud.node_cpu_capacity_cores:
    enabled: true
    description: The capacity cores of TiDB/TiKV/TiFlash nodes.
    unit: 1
    gauge:
      value_type: double
    attributes: [cluster_name, cluster_id, instance, component]



  tidb_cloud.node_memory_used_bytes:
    enabled: true
    description: The used memory bytes of TiDB/TiKV/TiFlash nodes.
    unit: By
    gauge:
      value_type: int
    attributes: [cluster_name, cluster_id, instance, component]
  tidb_cloud.node_memory_capacity_bytes:
    enabled: true
    description: The memory capacity bytes of TiDB/TiKV/TiFlash nodes.
    unit: By
    gauge:
      value_type: int
    attributes: [cluster_name, cluster_id, instance, component]
