Db

General Database Attributes

This group defines the attributes used to describe telemetry in the context of databases.

AttributeTypeDescriptionExamplesStability
db.client.connection.pool.namestringThe name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn’t provide a name, instrumentation SHOULD use a combination of parameters that would make the name unique, for example, combining attributes server.address, server.port, and db.namespace, formatted as server.address:server.port/db.namespace. Instrumentations that generate connection pool name following different patterns SHOULD document it.myDataSourceExperimental
db.client.connection.statestringThe state of a connection in the poolidleExperimental
db.collection.namestringThe name of a collection (table, container) within the database. [1]public.users; customersExperimental
db.namespacestringThe name of the database, fully qualified within the server address and port. [2]customers; test.usersExperimental
db.operation.batch.sizeintThe number of queries included in a batch operation. [3]2; 3; 4Experimental
db.operation.namestringThe name of the operation or command being executed. [4]findAndModify; HMSET; SELECTExperimental
db.operation.parameter.<key>stringA database operation parameter, with <key> being the parameter name, and the attribute value being a string representation of the parameter value. [5]someval; 55Experimental
db.query.summarystringLow cardinality representation of a database query text. [6]SELECT wuser_table; INSERT shipping_details SELECT orders; get user by idExperimental
db.query.textstringThe database query being executed. [7]SELECT * FROM wuser_table where username = ?; SET mykey ?Experimental
db.response.returned_rowsintNumber of rows returned by the operation.10; 30; 1000Experimental
db.response.status_codestringDatabase response status code. [8]102; ORA-17002; 08P01; 404Experimental
db.systemstringThe database management system (DBMS) product as identified by the client instrumentation. [9]other_sql; adabas; cacheExperimental

[1] db.collection.name: It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

The collection name SHOULD NOT be extracted from db.query.text, unless the query format is known to only ever have a single collection name present.

For batch operations, if the individual operations are known to have the same collection name then that collection name SHOULD be used.

This attribute has stability level RELEASE CANDIDATE.

[2] db.namespace: 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] db.operation.batch.size: 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] db.operation.name: It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

The operation name SHOULD NOT be extracted from db.query.text, unless the query format is known to only ever have a single operation name present.

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] db.operation.parameter: If a parameter has no name and instead is referenced only by index, then <key> SHOULD be the 0-based index. If db.query.text is also captured, then db.operation.parameter.<key> SHOULD match up with the parameterized placeholders present in db.query.text. This attribute has stability level RELEASE CANDIDATE.

[6] db.query.summary: db.query.summary provides static summary of the query text. It describes a class of database queries and is useful as a grouping key, especially when analyzing telemetry for database calls involving complex queries. Summary may be available to the instrumentation through instrumentation hooks or other means. If it is not available, instrumentations that support query parsing SHOULD generate a summary following Generating query summary section. This attribute has stability level RELEASE CANDIDATE.

[7] db.query.text: 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.

[8] db.response.status_code: 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.

[9] db.system: 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.

ValueDescriptionStability
idleidleExperimental
usedusedExperimental

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.

ValueDescriptionStability
adabasAdabas (Adaptable Database System)Experimental
cacheDeprecated, use intersystems_cache instead.Deprecated
Replaced by intersystems_cache.
cassandraApache CassandraExperimental
clickhouseClickHouseExperimental
cloudscapeDeprecated, use other_sql instead.Deprecated
Replaced by other_sql.
cockroachdbCockroachDBExperimental
coldfusionDeprecated, no replacement at this time.Deprecated
Removed.
cosmosdbMicrosoft Azure Cosmos DBExperimental
couchbaseCouchbaseExperimental
couchdbCouchDBExperimental
db2IBM Db2Experimental
derbyApache DerbyExperimental
dynamodbAmazon DynamoDBExperimental
edbEnterpriseDBExperimental
elasticsearchElasticsearchExperimental
filemakerFileMakerExperimental
firebirdFirebirdExperimental
firstsqlDeprecated, use other_sql instead.Deprecated
Replaced by other_sql.
geodeApache GeodeExperimental
h2H2Experimental
hanadbSAP HANAExperimental
hbaseApache HBaseExperimental
hiveApache HiveExperimental
hsqldbHyperSQL DataBaseExperimental
influxdbInfluxDBExperimental
informixInformixExperimental
ingresIngresExperimental
instantdbInstantDBExperimental
interbaseInterBaseExperimental
intersystems_cacheInterSystems CachéExperimental
mariadbMariaDB (This value has stability level RELEASE CANDIDATE)Experimental
maxdbSAP MaxDBExperimental
memcachedMemcachedExperimental
mongodbMongoDBExperimental
mssqlMicrosoft SQL Server (This value has stability level RELEASE CANDIDATE)Experimental
mssqlcompactDeprecated, Microsoft SQL Server Compact is discontinued.Deprecated
Removed, use other_sql instead.
mysqlMySQL (This value has stability level RELEASE CANDIDATE)Experimental
neo4jNeo4jExperimental
netezzaNetezzaExperimental
opensearchOpenSearchExperimental
oracleOracle DatabaseExperimental
other_sqlSome other SQL database. Fallback only. See notes.Experimental
pervasivePervasive PSQLExperimental
pointbasePointBaseExperimental
postgresqlPostgreSQL (This value has stability level RELEASE CANDIDATE)Experimental
progressProgress DatabaseExperimental
redisRedisExperimental
redshiftAmazon RedshiftExperimental
spannerCloud SpannerExperimental
sqliteSQLiteExperimental
sybaseSybaseExperimental
teradataTeradataExperimental
trinoTrinoExperimental
verticaVerticaExperimental

Cassandra Attributes

This group defines attributes for Cassandra.

AttributeTypeDescriptionExamplesStability
db.cassandra.consistency_levelstringThe consistency level of the query. Based on consistency values from CQL.all; each_quorum; quorumExperimental
db.cassandra.coordinator.dcstringThe data center of the coordinating node for a query.us-west-2Experimental
db.cassandra.coordinator.idstringThe ID of the coordinating node for a query.be13faa2-8574-4d71-926d-27f16cf8a7afExperimental
db.cassandra.idempotencebooleanWhether or not the query is idempotent.Experimental
db.cassandra.page_sizeintThe fetch size used for paging, i.e. how many rows will be returned at once.5000Experimental
db.cassandra.speculative_execution_countintThe number of times a query was speculatively executed. Not set or 0 if the query was not executed speculatively.0; 2Experimental

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.

ValueDescriptionStability
allallExperimental
anyanyExperimental
each_quorumeach_quorumExperimental
local_onelocal_oneExperimental
local_quorumlocal_quorumExperimental
local_seriallocal_serialExperimental
oneoneExperimental
quorumquorumExperimental
serialserialExperimental
threethreeExperimental
twotwoExperimental

Azure Cosmos DB Attributes

This group defines attributes for Azure Cosmos DB.

AttributeTypeDescriptionExamplesStability
db.cosmosdb.client_idstringUnique Cosmos client instance id.3ba4827d-4422-483f-b59f-85b74211c11dExperimental
db.cosmosdb.connection_modestringCosmos client connection mode.gateway; directExperimental
db.cosmosdb.consistency_levelstringAccount or request consistency level.Eventual; ConsistentPrefix; BoundedStaleness; Strong; SessionExperimental
db.cosmosdb.regions_contactedstring[]List of regions contacted during operation in the order that they were contacted. If there is more than one region listed, it indicates that the operation was performed on multiple regions i.e. cross-regional call. [10]["North Central US", "Australia East", "Australia Southeast"]Experimental
db.cosmosdb.request_chargedoubleRequest units consumed for the operation.46.18; 1.0Experimental
db.cosmosdb.request_content_lengthintRequest payload size in bytes.Experimental
db.cosmosdb.sub_status_codeintCosmos DB sub status code.1000; 1002Experimental

[10] db.cosmosdb.regions_contacted: Region name matches the format of displayName in Azure Location API


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.

ValueDescriptionStability
directDirect connection.Experimental
gatewayGateway (HTTP) connection.Experimental

db.cosmosdb.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.

ValueDescriptionStability
BoundedStalenessbounded_stalenessExperimental
ConsistentPrefixconsistent_prefixExperimental
EventualeventualExperimental
SessionsessionExperimental
StrongstrongExperimental

Elasticsearch Attributes

This group defines attributes for Elasticsearch.

AttributeTypeDescriptionExamplesStability
db.elasticsearch.node.namestringRepresents the human-readable identifier of the node/instance to which a request was routed.instance-0000000001Experimental
db.elasticsearch.path_parts.<key>stringA dynamic value in the url path. [11]db.elasticsearch.path_parts.index=test-index; db.elasticsearch.path_parts.doc_id=123Experimental

[11] db.elasticsearch.path_parts: 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.

Deprecated Database Attributes

“Describes deprecated db attributes.”

AttributeTypeDescriptionExamplesStability
db.cassandra.tablestringDeprecated, use db.collection.name instead.mytableDeprecated
Replaced by db.collection.name.
db.connection_stringstringDeprecated, use server.address, server.port attributes instead.Server=(localdb)\v11.0;Integrated Security=true;Deprecated
Replaced by server.address and server.port.
db.cosmosdb.containerstringDeprecated, use db.collection.name instead.mytableDeprecated
Replaced by db.collection.name.
db.cosmosdb.operation_typestringDeprecated, no replacement at this time.batch; create; deleteDeprecated
No replacement at this time.
db.cosmosdb.status_codeintDeprecated, use db.response.status_code instead.200; 201Deprecated
Replaced by db.response.status_code.
db.elasticsearch.cluster.namestringDeprecated, use db.namespace instead.e9106fc68e3044f0b1475b04bf4ffd5fDeprecated
Replaced by db.namespace.
db.instance.idstringDeprecated, no general replacement at this time. For Elasticsearch, use db.elasticsearch.node.name instead.mysql-e26b99z.example.comDeprecated
Deprecated, no general replacement at this time. For Elasticsearch, use db.elasticsearch.node.name instead.
db.jdbc.driver_classnamestringRemoved, no replacement at this time.org.postgresql.Driver; com.microsoft.sqlserver.jdbc.SQLServerDriverDeprecated
Removed as not used.
db.mongodb.collectionstringDeprecated, use db.collection.name instead.mytableDeprecated
Replaced by db.collection.name.
db.mssql.instance_namestringDeprecated, SQL Server instance is now populated as a part of db.namespace attribute.MSSQLSERVERDeprecated
Deprecated, no replacement at this time.
db.namestringDeprecated, use db.namespace instead.customers; mainDeprecated
Replaced by db.namespace.
db.operationstringDeprecated, use db.operation.name instead.findAndModify; HMSET; SELECTDeprecated
Replaced by db.operation.name.
db.query.parameter.<key>stringA query parameter used in db.query.text, with <key> being the parameter name, and the attribute value being a string representation of the parameter value.someval; 55Deprecated
Replaced by db.operation.parameter.
db.redis.database_indexintDeprecated, use db.namespace instead.0; 1; 15Deprecated
Replaced by db.namespace.
db.sql.tablestringDeprecated, use db.collection.name instead.mytableDeprecated
Replaced by db.collection.name.
db.statementstringThe database statement being executed.SELECT * FROM wuser_table; SET mykey "WuValue"Deprecated
Replaced by db.query.text.
db.userstringDeprecated, no replacement at this time.readonly_user; reporting_userDeprecated
No replacement at this time.

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.

ValueDescriptionStability
batchbatchExperimental
createcreateExperimental
deletedeleteExperimental
executeexecuteExperimental
execute_javascriptexecute_javascriptExperimental
headheadExperimental
head_feedhead_feedExperimental
invalidinvalidExperimental
patchpatchExperimental
queryqueryExperimental
query_planquery_planExperimental
readreadExperimental
read_feedread_feedExperimental
replacereplaceExperimental
upsertupsertExperimental

Deprecated Database Metrics

“Describes deprecated db metrics attributes.”

AttributeTypeDescriptionExamplesStability
db.client.connections.pool.namestringDeprecated, use db.client.connection.pool.name instead.myDataSourceDeprecated
Replaced by db.client.connection.pool.name.
db.client.connections.statestringDeprecated, use db.client.connection.state instead.idleDeprecated
Replaced by db.client.connection.state.
pool.namestringDeprecated, use db.client.connection.pool.name instead.myDataSourceDeprecated
Replaced by db.client.connection.pool.name.
statestringDeprecated, use db.client.connection.state instead.idleDeprecated
Replaced by db.client.connection.state.

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.

ValueDescriptionStability
idleidleExperimental
usedusedExperimental

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.

ValueDescriptionStability
idleidleExperimental
usedusedExperimental