semantic-conventions/docs/attributes-registry/db.md

20 KiB

Database

Generic Database Attributes

Attribute Type Description Examples Stability
db.instance.id string An 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.com Experimental
db.name string This 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; main Experimental
db.operation.name string The name of the operation or command being executed. findAndModify; HMSET; SELECT Experimental
db.statement string The database statement being executed. SELECT * FROM wuser_table; SET mykey "WuValue" Experimental
db.system string An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. other_sql Experimental
db.user string Username for accessing the database. readonly_user; reporting_user Experimental

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

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.

Value Description Stability
other_sql Some other SQL database. Fallback only. See notes. Experimental
mssql Microsoft SQL Server Experimental
mssqlcompact Microsoft SQL Server Compact Experimental
mysql MySQL Experimental
oracle Oracle Database Experimental
db2 IBM Db2 Experimental
postgresql PostgreSQL Experimental
redshift Amazon Redshift Experimental
hive Apache Hive Experimental
cloudscape Cloudscape Experimental
hsqldb HyperSQL DataBase Experimental
progress Progress Database Experimental
maxdb SAP MaxDB Experimental
hanadb SAP HANA Experimental
ingres Ingres Experimental
firstsql FirstSQL Experimental
edb EnterpriseDB Experimental
cache InterSystems Caché Experimental
adabas Adabas (Adaptable Database System) Experimental
firebird Firebird Experimental
derby Apache Derby Experimental
filemaker FileMaker Experimental
informix Informix Experimental
instantdb InstantDB Experimental
interbase InterBase Experimental
mariadb MariaDB Experimental
netezza Netezza Experimental
pervasive Pervasive PSQL Experimental
pointbase PointBase Experimental
sqlite SQLite Experimental
sybase Sybase Experimental
teradata Teradata Experimental
vertica Vertica Experimental
h2 H2 Experimental
coldfusion ColdFusion IMQ Experimental
cassandra Apache Cassandra Experimental
hbase Apache HBase Experimental
mongodb MongoDB Experimental
redis Redis Experimental
couchbase Couchbase Experimental
couchdb CouchDB Experimental
cosmosdb Microsoft Azure Cosmos DB Experimental
dynamodb Amazon DynamoDB Experimental
neo4j Neo4j Experimental
geode Apache Geode Experimental
elasticsearch Elasticsearch Experimental
memcached Memcached Experimental
cockroachdb CockroachDB Experimental
opensearch OpenSearch Experimental
clickhouse ClickHouse Experimental
spanner Cloud Spanner Experimental
trino Trino Experimental

Cassandra Attributes

Attribute Type Description Examples Stability
db.cassandra.consistency_level string The consistency level of the query. Based on consistency values from CQL. all Experimental
db.cassandra.coordinator.dc string The data center of the coordinating node for a query. us-west-2 Experimental
db.cassandra.coordinator.id string The ID of the coordinating node for a query. be13faa2-8574-4d71-926d-27f16cf8a7af Experimental
db.cassandra.idempotence boolean Whether or not the query is idempotent. Experimental
db.cassandra.page_size int The fetch size used for paging, i.e. how many rows will be returned at once. 5000 Experimental
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 Experimental
db.cassandra.table string The name of the primary Cassandra table that the operation is acting upon, including the keyspace name (if applicable). [1] mytable Experimental

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

Value Description Stability
all all Experimental
each_quorum each_quorum Experimental
quorum quorum Experimental
local_quorum local_quorum Experimental
one one Experimental
two two Experimental
three three Experimental
local_one local_one Experimental
any any Experimental
serial serial Experimental
local_serial local_serial Experimental

CosmosDB Attributes

Attribute Type Description Examples Stability
db.cosmosdb.client_id string Unique Cosmos client instance id. 3ba4827d-4422-483f-b59f-85b74211c11d Experimental
db.cosmosdb.connection_mode string Cosmos client connection mode. gateway Experimental
db.cosmosdb.container string Cosmos DB container name. anystring Experimental
db.cosmosdb.operation_type string CosmosDB Operation Type. Invalid Experimental
db.cosmosdb.request_charge double RU consumed for that operation 46.18; 1.0 Experimental
db.cosmosdb.request_content_length int Request payload size in bytes Experimental
db.cosmosdb.status_code int Cosmos DB status code. 200; 201 Experimental
db.cosmosdb.sub_status_code int Cosmos DB sub status code. 1000; 1002 Experimental

db.cosmosdb.connection_mode MUST be one of the following:

Value Description Stability
gateway Gateway (HTTP) connections mode Experimental
direct Direct 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.

Value Description Stability
Invalid invalid Experimental
Create create Experimental
Patch patch Experimental
Read read Experimental
ReadFeed read_feed Experimental
Delete delete Experimental
Replace replace Experimental
Execute execute Experimental
Query query Experimental
Head head Experimental
HeadFeed head_feed Experimental
Upsert upsert Experimental
Batch batch Experimental
QueryPlan query_plan Experimental
ExecuteJavaScript execute_javascript Experimental

Elasticsearch Attributes

Attribute Type Description Examples Stability
db.elasticsearch.cluster.name string Represents the identifier of an Elasticsearch cluster. e9106fc68e3044f0b1475b04bf4ffd5f Experimental
db.elasticsearch.path_parts.<key> string A dynamic value in the url path. [1] db.elasticsearch.path_parts.index=test-index; db.elasticsearch.path_parts.doc_id=123 Experimental

[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

Attribute Type Description Examples Stability
db.mongodb.collection string The MongoDB collection being accessed within the database stated in db.name. customers; products Experimental

MSSQL Attributes

Attribute Type Description Examples Stability
db.mssql.instance_name string The Microsoft SQL Server instance name connecting to. This name is used to determine the port of a named instance. [1] MSSQLSERVER Experimental

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

Redis Attributes

Attribute Type Description Examples Stability
db.redis.database_index int The 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; 15 Experimental

SQL Attributes

Attribute Type Description Examples Stability
db.sql.table string The name of the primary table that the operation is acting upon, including the database name (if applicable). [1] public.users; customers Experimental

[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

Attribute Type Description Examples Stability
db.connection_string string Deprecated, 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.name string Deprecated, use db.instance.id instead. instance-0000000001 Deprecated
Replaced by db.instance.id.
db.jdbc.driver_classname string Removed, no replacement at this time. org.postgresql.Driver; com.microsoft.sqlserver.jdbc.SQLServerDriver Deprecated
Removed as not used.
db.operation string Deprecated, use db.operation.name instead. findAndModify; HMSET; SELECT Deprecated
Replaced by db.operation.name.

Deprecated Elasticsearch Attributes

Attribute Type Description Examples Stability
db.connection_string string Deprecated, 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.name string Deprecated, use db.instance.id instead. instance-0000000001 Deprecated
Replaced by db.instance.id.
db.jdbc.driver_classname string Removed, no replacement at this time. org.postgresql.Driver; com.microsoft.sqlserver.jdbc.SQLServerDriver Deprecated
Removed as not used.
db.operation string Deprecated, use db.operation.name instead. findAndModify; HMSET; SELECT Deprecated
Replaced by db.operation.name.