open-telemetry / semantic-conventions

Defines standards for generating consistent, accessible telemetry across a variety of domains
Apache License 2.0
251 stars 163 forks source link

Add `db.response.status_code` attribute, deprecate `db.cosmos.status_code` #1424

Open lmolkova opened 1 week ago

lmolkova commented 1 week ago

Introducing status code for database call based on the discussion in DB Semconv.

Most databases support a notion of a status code (usually representing an error, but also used for warnings and sometimes to differentiate success results).

E.g. SQL standard defines SQLSTATE - a string code. It, for example, appears on the java.sql.SqlException#getSQLState.

Databases that run on top of HTTP/gRPC/etc may also support status codes from that protocol. For example, Cosmos DB can run on top of HTTP or RNTBD (proprietary protocol), but needs one status code for both.

HBase supports HTTP, Thrift and gRPC and may report different codes depending on the protocol.


We need a place to capture DB response code that's not protocol-specific and could be reported on common metrics for all databases.

error.type does not work at least in some cases

Merge requirement checklist