open-telemetry / semantic-conventions

Defines standards for generating consistent, accessible telemetry across a variety of domains
Apache License 2.0
282 stars 175 forks source link

Don't capture `db.operation.name` and `db.collection.name` from query formats that support multiples #1566

Open trask opened 1 week ago

trask commented 1 week ago

Don't capture db.operation.name and db.collection.name from query formats that support multiples.

The reason behind this change is that it could be confusing to have db.operation.name and db.collection.name captured for some SQL operations but not for other SQL operations, also leading to an inconsistent experience in SQL metrics.

And these parsed values (single or multiple) are now present in db.query.summary, so the loss of information seems minimal.

Specifically, db.operation.name is changed from:

A single database query may involve multiple operations. If the operation name is parsed from the query text, it SHOULD only be captured for queries that contain a single operation or when the operation name describing the whole query is available by other means.

to:

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.

and db.collection.name is changed from:

If the collection name is parsed from the query text, it SHOULD only be captured for queries that contain a single collection and it SHOULD match the value provided in the query text including any schema and database name prefix.

to:

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 and the collection name is known to always be under the captured db.namespace.