Skip to content

Commit

Permalink
Don't capture db.operation.name and db.collection.name from query…
Browse files Browse the repository at this point in the history
… formats that support multiples (#1566)
  • Loading branch information
trask authored Nov 25, 2024
1 parent ab1362c commit 3fa52ac
Show file tree
Hide file tree
Showing 17 changed files with 230 additions and 362 deletions.
22 changes: 22 additions & 0 deletions .chloggen/1566.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Use this changelog template to create an entry for release notes.
#
# If your change doesn't affect end users you should instead start
# your pull request title with [chore] or use the "Skip Changelog" label.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
component: db

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Don't capture `db.operation.name` and `db.collection.name` from query formats that support multiples.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
# The values here must be integers.
issues: [ 1566 ]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
16 changes: 4 additions & 12 deletions docs/attributes-registry/db.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,12 @@ This group defines the attributes used to describe telemetry in the context of d

**[1] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

A single database query may involve multiple collections.

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

For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.

If the operation or query involves multiple collections, `db.collection.name`
SHOULD NOT be captured.

This attribute has stability level RELEASE CANDIDATE.

**[2] `db.namespace`:** 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.
Expand All @@ -59,10 +53,8 @@ This attribute has stability level RELEASE CANDIDATE.
**[4] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.

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

For batch operations, if the individual operations are known to have the same operation name
then that operation name SHOULD be used prepended by `BATCH `,
Expand Down
16 changes: 4 additions & 12 deletions docs/database/cassandra.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,12 @@ The Semantic Conventions for [Cassandra](https://cassandra.apache.org/) extend a

**[1] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

A single database query may involve multiple collections.

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

For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.

If the operation or query involves multiple collections, `db.collection.name`
SHOULD NOT be captured.

This attribute has stability level RELEASE CANDIDATE.

**[2] `db.collection.name`:** If readily available and if a database call is performed on a single collection. The collection name MAY be parsed from the query text, in which case it SHOULD be the single collection name in the query.
Expand All @@ -68,10 +62,8 @@ This attribute has stability level RELEASE CANDIDATE.
**[4] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.

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

For batch operations, if the individual operations are known to have the same operation name
then that operation name SHOULD be used prepended by `BATCH `,
Expand Down
16 changes: 11 additions & 5 deletions docs/database/cosmosdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ Explaining bucket configuration:

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`db.collection.name`](/docs/attributes-registry/db.md) | string | Cosmos DB container name. [1] | `public.users`; `customers` | `Conditionally Required` If available | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`db.collection.name`](/docs/attributes-registry/db.md) | string | Cosmos DB container name. [1] | `public.users`; `customers` | `Conditionally Required` If available. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`db.cosmosdb.consistency_level`](/docs/attributes-registry/db.md) | string | Account or request [consistency level](https://learn.microsoft.com/azure/cosmos-db/consistency-levels). | `Eventual`; `ConsistentPrefix`; `BoundedStaleness`; `Strong`; `Session` | `Conditionally Required` If available. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`db.cosmosdb.sub_status_code`](/docs/attributes-registry/db.md) | int | Cosmos DB sub status code. | `1000`; `1002` | `Conditionally Required` when response was received and contained sub-code. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`db.namespace`](/docs/attributes-registry/db.md) | string | The name of the database, fully qualified within the server address and port. | `customers`; `test.users` | `Conditionally Required` If available. | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Expand All @@ -358,13 +358,19 @@ Explaining bucket configuration:

**[1] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

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.

For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.

This attribute has stability level RELEASE CANDIDATE.

**[2] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.

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

For batch operations, if the individual operations are known to have the same operation name
then that operation name SHOULD be used prepended by `BATCH `,
Expand Down
32 changes: 8 additions & 24 deletions docs/database/database-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,12 @@ This attribute has stability level RELEASE CANDIDATE.

**[2] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

A single database query may involve multiple collections.

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

For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.

If the operation or query involves multiple collections, `db.collection.name`
SHOULD NOT be captured.

This attribute has stability level RELEASE CANDIDATE.

**[3] `db.collection.name`:** If readily available and if a database call is performed on a single collection. The collection name MAY be parsed from the query text, in which case it SHOULD be the single collection name in the query.
Expand All @@ -125,10 +119,8 @@ This attribute has stability level RELEASE CANDIDATE.
**[5] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.

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

For batch operations, if the individual operations are known to have the same operation name
then that operation name SHOULD be used prepended by `BATCH `,
Expand Down Expand Up @@ -290,18 +282,12 @@ This attribute has stability level RELEASE CANDIDATE.

**[2] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

A single database query may involve multiple collections.

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

For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.

If the operation or query involves multiple collections, `db.collection.name`
SHOULD NOT be captured.

This attribute has stability level RELEASE CANDIDATE.

**[3] `db.collection.name`:** If readily available and if a database call is performed on a single collection. The collection name MAY be parsed from the query text, in which case it SHOULD be the single collection name in the query.
Expand All @@ -314,10 +300,8 @@ This attribute has stability level RELEASE CANDIDATE.
**[5] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.

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

For batch operations, if the individual operations are known to have the same operation name
then that operation name SHOULD be used prepended by `BATCH `,
Expand Down
16 changes: 4 additions & 12 deletions docs/database/database-spans.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,12 @@ This attribute has stability level RELEASE CANDIDATE.

**[2] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

A single database query may involve multiple collections.

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

For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.

If the operation or query involves multiple collections, `db.collection.name`
SHOULD NOT be captured.

This attribute has stability level RELEASE CANDIDATE.

**[3] `db.collection.name`:** If readily available and if a database call is performed on a single collection. The collection name MAY be parsed from the query text, in which case it SHOULD be the single collection name in the query.
Expand All @@ -143,10 +137,8 @@ This attribute has stability level RELEASE CANDIDATE.
**[5] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.

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

For batch operations, if the individual operations are known to have the same operation name
then that operation name SHOULD be used prepended by `BATCH `,
Expand Down
6 changes: 2 additions & 4 deletions docs/database/hbase.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ This attribute has stability level RELEASE CANDIDATE.
**[3] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.

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

For batch operations, if the individual operations are known to have the same operation name
then that operation name SHOULD be used prepended by `BATCH `,
Expand Down
Loading

0 comments on commit 3fa52ac

Please sign in to comment.