db.query.text
The database query being executed.
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.
Parameterized query text SHOULD NOT be sanitized. 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.
Examples
- SELECT * FROM wuser_table where username = ?
- SET mykey ?
Used by
metrics (4)
- db.client.operation.duration (opt-in)
- db.client.operation.duration
- db.client.response.returned_rows (opt-in)
- db.client.response.returned_rows
spans (11)
- span.azure.cosmosdb.client
- span.db.cassandra.client
- span.db.client
- span.db.elasticsearch.client
- span.db.mariadb.client
- span.db.mysql.client
- span.db.oracledb.client
- span.db.postgresql.client
- span.db.redis.client
- span.db.sql_server.client
- span.db.sql.client
* required on that signal.
History
- v1.33.0stability
Promoted to stable.
Already present at v1.30.0, the oldest release tracked here (release_candidate).