Semantic Conventions for Database Metrics

Status: Experimental

The conventions described in this section are specific to SQL and NoSQL clients.

Disclaimer: These are initial database client metric instruments and attributes but more may be added in the future.

Connection pools

The following metric instruments describe database client connection pool operations.

Metric: db.client.connections.usage

This metric is required.

NameInstrument TypeUnit (UCUM)Description
db.client.connections.usageUpDownCounter{connection}The number of connections that are currently in state described by the state attribute
AttributeTypeDescriptionExamplesRequirement Level
pool.namestringThe name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn’t provide a name, then the db.connection_string should be usedmyDataSourceRequired
statestringThe state of a connection in the poolidleRequired

state MUST be one of the following:

ValueDescription
idleidle
usedused

Metric: db.client.connections.idle.max

This metric is recommended.

NameInstrument TypeUnit (UCUM)Description
db.client.connections.idle.maxUpDownCounter{connection}The maximum number of idle open connections allowed
AttributeTypeDescriptionExamplesRequirement Level
pool.namestringThe name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn’t provide a name, then the db.connection_string should be usedmyDataSourceRequired

Metric: db.client.connections.idle.min

This metric is recommended.

NameInstrument TypeUnit (UCUM)Description
db.client.connections.idle.minUpDownCounter{connection}The minimum number of idle open connections allowed
AttributeTypeDescriptionExamplesRequirement Level
pool.namestringThe name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn’t provide a name, then the db.connection_string should be usedmyDataSourceRequired

Metric: db.client.connections.max

This metric is recommended.

NameInstrument TypeUnit (UCUM)Description
db.client.connections.maxUpDownCounter{connection}The maximum number of open connections allowed
AttributeTypeDescriptionExamplesRequirement Level
pool.namestringThe name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn’t provide a name, then the db.connection_string should be usedmyDataSourceRequired

Metric: db.client.connections.pending_requests

This metric is recommended.

NameInstrument TypeUnit (UCUM)Description
db.client.connections.pending_requestsUpDownCounter{request}The number of pending requests for an open connection, cumulative for the entire pool
AttributeTypeDescriptionExamplesRequirement Level
pool.namestringThe name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn’t provide a name, then the db.connection_string should be usedmyDataSourceRequired

Metric: db.client.connections.timeouts

This metric is recommended.

NameInstrument TypeUnit (UCUM)Description
db.client.connections.timeoutsCounter{timeout}The number of connection timeouts that have occurred trying to obtain a connection from the pool
AttributeTypeDescriptionExamplesRequirement Level
pool.namestringThe name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn’t provide a name, then the db.connection_string should be usedmyDataSourceRequired

Metric: db.client.connections.create_time

This metric is recommended.

NameInstrument TypeUnit (UCUM)Description
db.client.connections.create_timeHistogrammsThe time it took to create a new connection
AttributeTypeDescriptionExamplesRequirement Level
pool.namestringThe name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn’t provide a name, then the db.connection_string should be usedmyDataSourceRequired

Metric: db.client.connections.wait_time

This metric is recommended.

NameInstrument TypeUnit (UCUM)Description
db.client.connections.wait_timeHistogrammsThe time it took to obtain an open connection from the pool
AttributeTypeDescriptionExamplesRequirement Level
pool.namestringThe name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn’t provide a name, then the db.connection_string should be usedmyDataSourceRequired

Metric: db.client.connections.use_time

This metric is recommended.

NameInstrument TypeUnit (UCUM)Description
db.client.connections.use_timeHistogrammsThe time between borrowing a connection and returning it to the pool
AttributeTypeDescriptionExamplesRequirement Level
pool.namestringThe name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn’t provide a name, then the db.connection_string should be usedmyDataSourceRequired