- General Database Attributes
- Cassandra Attributes
- Azure Cosmos DB Attributes
- Elasticsearch Attributes
- Deprecated Database Attributes
- Deprecated Database Metrics
This group defines the attributes used to describe telemetry in the context of databases.
[1]: It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
If the collection name is parsed from the query text, it SHOULD be the first collection name found in the query and it SHOULD match the value provided in the query text including any schema and database name prefix.
For batch operations, if the individual operations are known to have the same collection name then that collection name SHOULD be used, otherwise db.collection.name
SHOULD NOT be captured.
This attribute has stability level RELEASE CANDIDATE.
[2]: If a database system has multiple namespace components, they SHOULD be concatenated (potentially using database system specific conventions) from most general to most specific namespace component, and more specific namespaces SHOULD NOT be captured without the more general namespaces, to ensure that "startswith" queries for the more general namespaces will be valid.
Semantic conventions for individual database systems SHOULD document what db.namespace
means in the context of that system.
It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
This attribute has stability level RELEASE CANDIDATE.
[3]: Operations are only considered batches when they contain two or more operations, and so db.operation.batch.size
SHOULD never be 1
.
This attribute has stability level RELEASE CANDIDATE.
[4]: It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
If the operation name is parsed from the query text, it SHOULD be the first operation name found in the query.
For batch operations, if the individual operations are known to have the same operation name then that operation name SHOULD be used prepended by BATCH
, otherwise db.operation.name
SHOULD be BATCH
or some other database system specific term if more applicable.
This attribute has stability level RELEASE CANDIDATE.
[5]: Query parameters should only be captured when db.query.text
is parameterized with placeholders.
If a parameter has no name and instead is referenced only by index, then <key>
SHOULD be the 0-based index.
This attribute has stability level RELEASE CANDIDATE.
[6]: For sanitization see Sanitization of db.query.text
.
For batch operations, if the individual operations are known to have the same query text then that query text SHOULD be used, otherwise all of the individual query texts SHOULD be concatenated with separator ;
or some other database system specific separator if more applicable.
Even though parameterized query text can potentially have sensitive data, by using a parameterized query the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit to observability of capturing the static part of the query text by default outweighs the risk.
This attribute has stability level RELEASE CANDIDATE.
[7]: The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.
Semantic conventions for individual database systems SHOULD document what db.response.status_code
means in the context of that system.
This attribute has stability level RELEASE CANDIDATE.
[8]: The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the db.system
is set to postgresql
based on the instrumentation's best knowledge.
This attribute has stability level RELEASE CANDIDATE.
db.client.connection.state
has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
Value | Description | Stability |
---|---|---|
idle |
idle | |
used |
used |
db.system
has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
This group defines attributes for Cassandra.
Attribute | Type | Description | Examples | Stability |
---|---|---|---|---|
db.cassandra.consistency_level |
string | The consistency level of the query. Based on consistency values from CQL. | all ; each_quorum ; quorum |
|
db.cassandra.coordinator.dc |
string | The data center of the coordinating node for a query. | us-west-2 |
|
db.cassandra.coordinator.id |
string | The ID of the coordinating node for a query. | be13faa2-8574-4d71-926d-27f16cf8a7af |
|
db.cassandra.idempotence |
boolean | Whether or not the query is idempotent. | ||
db.cassandra.page_size |
int | The fetch size used for paging, i.e. how many rows will be returned at once. | 5000 |
|
db.cassandra.speculative_execution_count |
int | The number of times a query was speculatively executed. Not set or 0 if the query was not executed speculatively. |
0 ; 2 |
db.cassandra.consistency_level
has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
Value | Description | Stability |
---|---|---|
all |
all | |
any |
any | |
each_quorum |
each_quorum | |
local_one |
local_one | |
local_quorum |
local_quorum | |
local_serial |
local_serial | |
one |
one | |
quorum |
quorum | |
serial |
serial | |
three |
three | |
two |
two |
This group defines attributes for Azure Cosmos DB.
db.cosmosdb.connection_mode
has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
Value | Description | Stability |
---|---|---|
direct |
Direct connection. | |
gateway |
Gateway (HTTP) connections mode |
db.cosmosdb.operation_type
has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
This group defines attributes for Elasticsearch.
[9]: Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format db.elasticsearch.path_parts.<key>
, where <key>
is the url path part name. The implementation SHOULD reference the elasticsearch schema in order to map the path part values to their names.
"Describes deprecated db attributes."
"Describes deprecated db metrics attributes."
db.client.connections.state
has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
Value | Description | Stability |
---|---|---|
idle |
idle | |
used |
used |
state
has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
Value | Description | Stability |
---|---|---|
idle |
idle | |
used |
used |