Db

Db Attributes

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

AttributeTypeDescriptionExamplesStability
db.client.connections.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 server.address and server.port attributes formatted as server.address:server.port.myDataSourceExperimental
db.client.connections.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.namestringThe name of the operation or command being executed. [3]findAndModify; HMSET; SELECTExperimental
db.query.parameter.<key>stringThe query parameters used in db.query.text, with <key> being the parameter name, and the attribute value being the parameter value. [4]someval; 55Experimental
db.query.textstringThe database query being executed.SELECT * FROM wuser_table where username = ?; SET mykey "WuValue"Experimental
db.systemstringThe database management system (DBMS) product as identified by the client instrumentation. [5]other_sql; mssql; mssqlcompactExperimental

[1]: If the collection name is parsed from the query, it SHOULD match the value provided in the query and may be qualified with the schema and database name. It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

[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.

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

[4]: 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.

[5]: 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.

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

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
other_sqlSome other SQL database. Fallback only. See notes.Experimental
mssqlMicrosoft SQL ServerExperimental
mssqlcompactMicrosoft SQL Server CompactExperimental
mysqlMySQLExperimental
oracleOracle DatabaseExperimental
db2IBM Db2Experimental
postgresqlPostgreSQLExperimental
redshiftAmazon RedshiftExperimental
hiveApache HiveExperimental
cloudscapeCloudscapeExperimental
hsqldbHyperSQL DataBaseExperimental
progressProgress DatabaseExperimental
maxdbSAP MaxDBExperimental
hanadbSAP HANAExperimental
ingresIngresExperimental
firstsqlFirstSQLExperimental
edbEnterpriseDBExperimental
cacheInterSystems CachéExperimental
adabasAdabas (Adaptable Database System)Experimental
firebirdFirebirdExperimental
derbyApache DerbyExperimental
filemakerFileMakerExperimental
informixInformixExperimental
instantdbInstantDBExperimental
interbaseInterBaseExperimental
mariadbMariaDBExperimental
netezzaNetezzaExperimental
pervasivePervasive PSQLExperimental
pointbasePointBaseExperimental
sqliteSQLiteExperimental
sybaseSybaseExperimental
teradataTeradataExperimental
verticaVerticaExperimental
h2H2Experimental
coldfusionColdFusion IMQExperimental
cassandraApache CassandraExperimental
hbaseApache HBaseExperimental
mongodbMongoDBExperimental
redisRedisExperimental
couchbaseCouchbaseExperimental
couchdbCouchDBExperimental
cosmosdbMicrosoft Azure Cosmos DBExperimental
dynamodbAmazon DynamoDBExperimental
neo4jNeo4jExperimental
geodeApache GeodeExperimental
elasticsearchElasticsearchExperimental
memcachedMemcachedExperimental
cockroachdbCockroachDBExperimental
opensearchOpenSearchExperimental
clickhouseClickHouseExperimental
spannerCloud SpannerExperimental
trinoTrinoExperimental

Db 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
each_quorumeach_quorumExperimental
quorumquorumExperimental
local_quorumlocal_quorumExperimental
oneoneExperimental
twotwoExperimental
threethreeExperimental
local_onelocal_oneExperimental
anyanyExperimental
serialserialExperimental
local_seriallocal_serialExperimental

Db CosmosDB 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.operation_typestringCosmosDB Operation Type.Invalid; Create; PatchExperimental
db.cosmosdb.request_chargedoubleRU consumed for that operation46.18; 1.0Experimental
db.cosmosdb.request_content_lengthintRequest payload size in bytesExperimental
db.cosmosdb.status_codeintCosmos DB status code.200; 201Experimental
db.cosmosdb.sub_status_codeintCosmos DB sub status code.1000; 1002Experimental

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
gatewayGateway (HTTP) connections modeExperimental
directDirect connection.Experimental

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
InvalidinvalidExperimental
CreatecreateExperimental
PatchpatchExperimental
ReadreadExperimental
ReadFeedread_feedExperimental
DeletedeleteExperimental
ReplacereplaceExperimental
ExecuteexecuteExperimental
QueryqueryExperimental
HeadheadExperimental
HeadFeedhead_feedExperimental
UpsertupsertExperimental
BatchbatchExperimental
QueryPlanquery_planExperimental
ExecuteJavaScriptexecute_javascriptExperimental

Db Deprecated 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.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.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 Elasticsearch Attributes

This group defines attributes for Elasticsearch.

AttributeTypeDescriptionExamplesStability
db.elasticsearch.cluster.namestringRepresents the identifier of an Elasticsearch cluster.e9106fc68e3044f0b1475b04bf4ffd5fExperimental
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. [6]db.elasticsearch.path_parts.index=test-index; db.elasticsearch.path_parts.doc_id=123Experimental

[6]: 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.

Db Metrics Deprecated Attributes

“Describes deprecated db metrics attributes.”

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

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