Database

Generic Database Attributes

AttributeTypeDescriptionExamplesStability
db.instance.idstringAn identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like select @@hostname.mysql-e26b99z.example.comExperimental
db.namestringThis attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails). [1]customers; mainExperimental
db.operationstringThe name of the operation being executed, e.g. the MongoDB command name such as findAndModify, or the SQL keyword. [2]findAndModify; HMSET; SELECTExperimental
db.statementstringThe database statement being executed.SELECT * FROM wuser_table; SET mykey "WuValue"Experimental
db.systemstringAn identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.other_sqlExperimental
db.userstringUsername for accessing the database.readonly_user; reporting_userExperimental

[1]: In some SQL databases, the database name to be used is called “schema name”. In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name).

[2]: When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of db.statement just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted.

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

Cassandra Attributes

AttributeTypeDescriptionExamplesStability
db.cassandra.consistency_levelstringThe consistency level of the query. Based on consistency values from CQL.allExperimental
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.tablestringThe name of the primary Cassandra table that the operation is acting upon, including the keyspace name (if applicable). [1]mytableExperimental

[1]: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of db.statement just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.

db.cassandra.consistency_level MUST be one of the following:

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

CosmosDB Attributes

AttributeTypeDescriptionExamplesStability
db.cosmosdb.client_idstringUnique Cosmos client instance id.3ba4827d-4422-483f-b59f-85b74211c11dExperimental
db.cosmosdb.connection_modestringCosmos client connection mode.gatewayExperimental
db.cosmosdb.containerstringCosmos DB container name.anystringExperimental
db.cosmosdb.operation_typestringCosmosDB Operation Type.InvalidExperimental
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 MUST be one of the following:

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

Elasticsearch Attributes

AttributeTypeDescriptionExamplesStability
db.elasticsearch.cluster.namestringRepresents the identifier of an Elasticsearch cluster.e9106fc68e3044f0b1475b04bf4ffd5fExperimental
db.elasticsearch.path_parts.<key>stringA dynamic value in the url path. [1]db.elasticsearch.path_parts.index=test-index; db.elasticsearch.path_parts.doc_id=123Experimental

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

MongoDB Attributes

AttributeTypeDescriptionExamplesStability
db.mongodb.collectionstringThe MongoDB collection being accessed within the database stated in db.name.customers; productsExperimental

MSSQL Attributes

AttributeTypeDescriptionExamplesStability
db.mssql.instance_namestringThe Microsoft SQL Server instance name connecting to. This name is used to determine the port of a named instance. [1]MSSQLSERVERExperimental

[1]: If setting a db.mssql.instance_name, server.port is no longer required (but still recommended if non-standard).

Redis Attributes

AttributeTypeDescriptionExamplesStability
db.redis.database_indexintThe index of the database being accessed as used in the SELECT command, provided as an integer. To be used instead of the generic db.name attribute.0; 1; 15Experimental

SQL Attributes

AttributeTypeDescriptionExamplesStability
db.sql.tablestringThe name of the primary table that the operation is acting upon, including the database name (if applicable). [1]public.users; customersExperimental

[1]: It is not recommended to attempt any client-side parsing of db.statement just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.

Deprecated DB Attributes

AttributeTypeDescriptionExamplesStability
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.elasticsearch.node.namestringDeprecated, use db.instance.id instead.instance-0000000001Deprecated
Replaced by db.instance.id.
db.jdbc.driver_classnamestringRemoved, no replacement at this time.org.postgresql.Driver; com.microsoft.sqlserver.jdbc.SQLServerDriverDeprecated
Removed as not used.

Deprecated Elasticsearch Attributes

AttributeTypeDescriptionExamplesStability
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.elasticsearch.node.namestringDeprecated, use db.instance.id instead.instance-0000000001Deprecated
Replaced by db.instance.id.
db.jdbc.driver_classnamestringRemoved, no replacement at this time.org.postgresql.Driver; com.microsoft.sqlserver.jdbc.SQLServerDriverDeprecated
Removed as not used.