Database semantic convention stability migration guide

Due to the significant number of modifications and the extensive user base affected by them, existing database instrumentations published by OpenTelemetry are required to implement a migration plan that will assist users in transitioning to the stable database semantic conventions.

Specifically, when existing database instrumentations published by OpenTelemetry are updated to the stable database semantic conventions, they:

  • SHOULD introduce an environment variable OTEL_SEMCONV_STABILITY_OPT_IN in their existing major version, which accepts:
    • database - emit the stable database conventions, and stop emitting the old database conventions that the instrumentation emitted previously.
    • database/dup - emit both the old and the stable database conventions, allowing for a phased rollout of the stable semantic conventions.
    • The default behavior (in the absence of one of these values) is to continue emitting whatever version of the old database conventions the instrumentation was emitting previously.
  • Need to maintain (security patching at a minimum) their existing major version for at least six months after it starts emitting both sets of conventions.
  • May drop the environment variable in their next major version and emit only the stable database conventions.

Summary of changes

This section summarizes the changes made to the HTTP semantic conventions from v1.24.0. to v1.28.0 (RC).

Database client span attributes

ChangeComments
db.connection_stringRemoved
db.userRemoved
network.transportRemoved
network.typeRemoved
db.nameRemoved, integrated into the new db.namespace
db.redis.database_indexRemoved, integrated into the new db.namespace
db.mssql.instance_nameRemoved, integrated into the new db.namespace
db.instance.idRemoved, replaced by server.address or integrated into db.namespace as appropriate
db.statementdb.query.textClarified, SHOULD be collected by default only if there is sanitization that excludes sensitive information
db.operationdb.operation.name
db.sql.tabledb.collection.name
db.cassandra.tabledb.collection.name
db.mongodb.collectiondb.collection.name
db.cosmosdb.containerdb.collection.name
New: db.operation.batch.size
New: db.response.status_code
New: db.operation.parameter.<key>Opt-In
New: error.type

References:

Database client span names

The recommended span name has changed to {db.operation.name} {target}, where the {target} SHOULD describe the entity that the operation is performed against and SHOULD adhere to one of the following values, provided they are accessible:

  • db.collection.name SHOULD be used for data manipulation operations or operations on database collections
  • db.namespace SHOULD be used for operations on a specific database namespace
  • server.address:server.port SHOULD be used for other operations not targeting any specific database(s) or collection(s)

References:

Database client operation duration metric

This is a required metric. There was no similar metric previously.

See Metric db.client.operation.duration v1.28.0 (RC).

Experimental connection metrics

Database connection metrics are still experimental, but there have been several changes in the latest release.

Database client connection count

Metric changes:

  • Name: db.client.connections.usagedb.client.connection.count
  • Attributes: see table below
Attribute changeComments
pool.namedb.client.connection.pool.name
statedb.client.connection.state

References:

Database client connection idle max

Metric changes:

  • Name: db.client.connections.idle.maxdb.client.connection.idle.max
  • Attributes: see table below
Attribute changeComments
pool.namedb.client.connection.pool.name

References:

Database client connection idle min

Metric changes:

  • Name: db.client.connections.idle.mindb.client.connection.idle.min
  • Attributes: see table below
Attribute changeComments
pool.namedb.client.connection.pool.name

References:

Database client connection max

Metric changes:

  • Name: db.client.connections.maxdb.client.connection.max
  • Attributes: see table below
Attribute changeComments
pool.namedb.client.connection.pool.name

References:

Database client connection pending requests

Metric changes:

  • Name: db.client.connections.pending_requestsdb.client.connection.pending_requests
  • Attributes: see table below
Attribute changeComments
pool.namedb.client.connection.pool.name

References:

Database client connection timeouts

Metric changes:

  • Name: db.client.connections.timeoutsdb.client.connection.timeouts
  • Attributes: see table below
Attribute changeComments
pool.namedb.client.connection.pool.name

References:

Database client connection create time

Metric changes:

  • Name: db.client.connections.create_timedb.client.connection.create_time
  • Unit: mss
  • Attributes: see table below
Attribute changeComments
pool.namedb.client.connection.pool.name

References:

Database client connection wait time

Metric changes:

  • Name: db.client.connections.wait_timedb.client.connection.wait_time
  • Unit: mss
  • Attributes: see table below
Attribute changeComments
pool.namedb.client.connection.pool.name

References:

Database client connection use time

Metric changes:

  • Name: db.client.connections.use_timedb.client.connection.use_time
  • Unit: mss
  • Attributes: see table below
Attribute changeComments
pool.namedb.client.connection.pool.name

References: