[comment]: <> (Code generated by mdatagen. DO NOT EDIT.)

# metadb

## Default Metrics

The following metrics are emitted by default. Each of them can be disabled by applying the following configuration:

```yaml
metrics:
  <metric_name>:
    enabled: false
```

### tidb_cloud.cdc_changefeed_latency

The checkpoint ts lag of a changefeed's owner.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| changefeed_id | Changefeed id. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| project_name | Project name. | Any Str |

### tidb_cloud.cdc_changefeed_replica_rows

The number of replica rows that ChangeFeed writes to the downstream per second.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| changefeed_id | Changefeed id. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| project_name | Project name. | Any Str |

### tidb_cloud.cdc_changefeed_resolved_ts_lag

The resolved ts lag of a changefeed's owner.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| changefeed_id | Changefeed id. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| project_name | Project name. | Any Str |

### tidb_cloud.cdc_changefeed_status

The status of a changefeed.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| changefeed_id | Changefeed id. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| project_name | Project name. | Any Str |

### tidb_cloud.cdc_checkpoint_ts

The checkpoint timestamp of a changefeed.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| changefeed_id | Changefeed id. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| project_name | Project name. | Any Str |

### tidb_cloud.db_active_connections

The number of active connection.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_average_query_duration

The duration between the time that the client's network request is sent to TiDB and the time that the request is returned to the client after TiDB has executed it. In general, client requests are sent in the form of SQL statements, but can also include the execution time of commands such as COM_PING, COM_SLEEP, COM_STMT_FETCH, and COM_SEND_LONG_DATA. Because TiDB supports Multi-Query, it supports sending multiple SQL statements at one time, such as select 1; select 1; select 1;. In this case, the total execution time of this query includes the execution time of all SQL statements.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| sql_type | The command types of sql statements, such as select, create, etc. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_columnar_storage_used_bytes

The columnar (TiFlash) storage usage for a TiDB X cluster.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| By | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| project_name | Project name. | Any Str |

### tidb_cloud.db_command_per_second

The number of commands processed by TiDB per second, which is classified according to the success or failure of command execution results.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| type | Types of query or type of query errors | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_component_uptime

The uptime of tidb components

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_connections

Current number of connections in TiDB server.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_database_time

A time model statistic that is the sum of all process' CPU consumption plus the sum of non-idle wait time.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| sql_type | The command types of sql statements, such as select, create, etc. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_disconnections

The number of clients disconnected.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| result | Result of disconnection. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_failed_queries

The statistics of error types (such as syntax errors and primary key conflicts) according to the errors occurred when executing SQL statements per second on each TiDB instance.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| type | Types of query or type of query errors | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_failed_queries_total

The total number of execution errors.

| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| 1 | Sum | Int | Unspecified | true |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| type | Types of query or type of query errors | Any Str |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_kv_request_duration

TiDB KV Request Duration

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| type | Types of query or type of query errors | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_queries_total

The total number of queries.

| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| 1 | Sum | Double | Unspecified | true |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| sql_type | The command types of sql statements, such as select, create, etc. | Any Str |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_queries_using_plan_cache_ops

The statistics of queries using Plan Cache per second. The execution plan cache only supports the prepared statement command. If the value is 0, the execution plan cache has not been hit.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| type | Types of query or type of query errors | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_query_duration_seconds.count

Total number of handled queries in server

| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| 1 | Sum | Int | Unspecified | true |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| sql_type | The command types of sql statements, such as select, create, etc. | Any Str |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_query_duration_seconds.sum

Total number of handled queries in server

| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| s | Sum | Int | Unspecified | true |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| sql_type | The command types of sql statements, such as select, create, etc. | Any Str |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_query_per_second

The number of SQL statements executed per second on all TiDB instances, which is counted according to SELECT, INSERT, UPDATE, and other types of statements.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| type | Types of query or type of query errors | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_row_storage_used_bytes

The row-based (TiKV) storage usage for a TiDB X cluster.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| By | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| project_name | Project name. | Any Str |

### tidb_cloud.db_total_connection

The number of current connection

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.db_transaction_per_second

The number of transactions executed per second.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| txn_mode | Transaction mode. | Any Str |
| type | Types of query or type of query errors | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.dm_relay_read_error_count

Task State

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| task | dm task. | Any Str |
| job_id | dm job id. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| project_name | Project name. | Any Str |

### tidb_cloud.dm_syncer_replication_lag_bucket

Task State

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| task | dm task. | Any Str |
| job_id | dm job id. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| project_name | Project name. | Any Str |

### tidb_cloud.dm_syncer_replication_lag_gauge

Task State

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| task | dm task. | Any Str |
| job_id | dm job id. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| project_name | Project name. | Any Str |

### tidb_cloud.dm_task_state

Task State

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| task | dm task. | Any Str |
| job_id | dm job id. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| project_name | Project name. | Any Str |

### tidb_cloud.node_cpu_capacity_cores

The capacity cores of TiDB/TiKV/TiFlash nodes.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.node_cpu_seconds_total

The CPU usage of TiDB/TiKV/TiFlash nodes.

| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| s | Sum | Int | Unspecified | true |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.node_cpu_seconds_total_rate

The CPU usage rate of TiDB/TiKV/TiFlash nodes.

| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| s | Sum | Double | Unspecified | true |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.node_disk_read_latency

Node disk read latency

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |
| device | device for disk latency | Any Str |

### tidb_cloud.node_disk_write_latency

Node disk write latency

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |
| device | device for disk latency | Any Str |

### tidb_cloud.node_memory_available_bytes

The memory capacity bytes of TiDB/TiKV/TiFlash nodes.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| By | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.node_memory_capacity_bytes

The memory capacity bytes of TiDB/TiKV/TiFlash nodes.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| By | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.node_memory_used_bytes

The used memory bytes of TiDB/TiKV/TiFlash nodes.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| By | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.node_storage_available_bytes

The disk available bytes of TiKV/TiFlash nodes.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| By | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.node_storage_capacity_bytes

The disk capacity bytes of TiKV/TiFlash nodes.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| By | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.node_storage_used_bytes

The disk usage bytes of TiKV/TiFlash nodes.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| By | Gauge | Int |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| cluster_name | Cluster name. | Any Str |
| cluster_id | Cluster ID. | Any Str |
| instance | Instance name. | Any Str |
| component | Components of a TiDB cluster. | Str: ``tidb``, ``tikv``, ``pd``, ``tiflash`` |
| project_name | Project name. | Any Str |

### tidb_cloud.resource_manager_resource_unit_read_request_unit

The resource manager read request.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| resource_group | Resource group. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| project_name | Project name. | Any Str |

### tidb_cloud.resource_manager_resource_unit_write_request_unit

The resource manager write request.

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Double |

#### Attributes

| Name | Description | Values |
| ---- | ----------- | ------ |
| resource_group | Resource group. | Any Str |
| cluster_name | Cluster name. | Any Str |
| instance | Instance name. | Any Str |
| project_name | Project name. | Any Str |

## Resource Attributes

| Name | Description | Values | Enabled |
| ---- | ----------- | ------ | ------- |
| cluster_id | The version of the elasticsearch node. | Any Str | true |
| cluster_name | The name of the elasticsearch index. | Any Str | true |
| project_id | The name of the elasticsearch cluster. | Any Str | true |
| project_name | The name of the elasticsearch node. | Any Str | true |
| service_plan | The service plan of the TiDB cluster (e.g. Dedicated, Premium, Essential, Starter). | Any Str | true |
