Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 11 commits into from
Nov 25, 2024
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
24 changes: 6 additions & 18 deletions docs/database/cassandra.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,16 @@ The Semantic Conventions for [Cassandra](https://cassandra.apache.org/) extend a
| [`network.peer.address`](/docs/attributes-registry/network.md) | string | Peer address of the database node where the operation was performed. [16] | `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`network.peer.port`](/docs/attributes-registry/network.md) | int | Peer port number of the network connection. | `65123` | `Recommended` if and only if `network.peer.address` is set. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [17] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`db.operation.parameter.<key>`](/docs/attributes-registry/db.md) | string | A database operation parameter, with `<key>` being the parameter name, and the attribute value being a string representation of the parameter value. [18] | `someval`; `55` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`db.query.parameter.<key>`](/docs/attributes-registry/db.md) | string | A query parameter used in `db.query.text`, with `<key>` being the parameter name, and the attribute value being a string representation of the parameter value. | `someval`; `55` | `Opt-In` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `db.operation.parameter`. |
trask marked this conversation as resolved.
Show resolved Hide resolved

**[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`,
trask marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -111,16 +103,12 @@ Even though parameterized query text can potentially have sensitive data, by usi
This attribute has stability level RELEASE CANDIDATE.

**[15] `db.query.text`:** Non-parameterized query text SHOULD NOT be collected by default unless there is sanitization that excludes sensitive data, e.g. by redacting all literal values present in the query text. See [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext).
Parameterized query text SHOULD be collected by default (the query parameter values themselves are opt-in, see [`db.operation.parameter.<key>`](../../docs/attributes-registry/db.md)).
Parameterized query text SHOULD be collected by default (the query parameter values themselves are opt-in, see [`db.query.parameter.<key>`](../../docs/attributes-registry/db.md)).

**[16] `network.peer.address`:** If a database operation involved multiple network calls (for example retries), the address of the last contacted node SHOULD be used.

**[17] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.

**[18] `db.operation.parameter`:** If a parameter has no name and instead is referenced only by index, then `<key>` SHOULD be the 0-based index.
If `db.query.text` is also captured, then `db.operation.parameter.<key>` SHOULD match up with the parameterized placeholders present in `db.query.text`.
This attribute has stability level RELEASE CANDIDATE.

The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

Expand Down
24 changes: 13 additions & 11 deletions docs/database/cosmosdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Cosmos DB instrumentation includes call-level (public API) surface spans and net
| [`db.query.text`](/docs/attributes-registry/db.md) | string | The database query being executed. [12] | `SELECT * FROM wuser_table where username = ?`; `SET mykey ?` | `Recommended` [13] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [14] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`user_agent.original`](/docs/attributes-registry/user-agent.md) | string | Full user-agent string is generated by Cosmos DB SDK [15] | `cosmos-netstandard-sdk/3.23.0\|3.23.1\|1\|X64\|Linux 5.4.0-1098-azure 104 18\|.NET Core 3.1.32\|S\|` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`db.operation.parameter.<key>`](/docs/attributes-registry/db.md) | string | A database operation parameter, with `<key>` being the parameter name, and the attribute value being a string representation of the parameter value. [16] | `someval`; `55` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`db.query.parameter.<key>`](/docs/attributes-registry/db.md) | string | A query parameter used in `db.query.text`, with `<key>` being the parameter name, and the attribute value being a string representation of the parameter value. | `someval`; `55` | `Opt-In` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `db.operation.parameter`. |

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

Expand Down Expand Up @@ -217,18 +217,14 @@ Even though parameterized query text can potentially have sensitive data, by usi
This attribute has stability level RELEASE CANDIDATE.

**[13] `db.query.text`:** Non-parameterized query text SHOULD NOT be collected by default unless there is sanitization that excludes sensitive data, e.g. by redacting all literal values present in the query text. See [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext).
Parameterized query text SHOULD be collected by default (the query parameter values themselves are opt-in, see [`db.operation.parameter.<key>`](../../docs/attributes-registry/db.md)).
Parameterized query text SHOULD be collected by default (the query parameter values themselves are opt-in, see [`db.query.parameter.<key>`](../../docs/attributes-registry/db.md)).

**[14] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.

**[15] `user_agent.original`:** The user-agent value is generated by SDK which is a combination of<br> `sdk_version` : Current version of SDK. e.g. 'cosmos-netstandard-sdk/3.23.0'<br> `direct_pkg_version` : Direct package version used by Cosmos DB SDK. e.g. '3.23.1'<br> `number_of_client_instances` : Number of cosmos client instances created by the application. e.g. '1'<br> `type_of_machine_architecture` : Machine architecture. e.g. 'X64'<br> `operating_system` : Operating System. e.g. 'Linux 5.4.0-1098-azure 104 18'<br> `runtime_framework` : Runtime Framework. e.g. '.NET Core 3.1.32'<br> `failover_information` : Generated key to determine if region failover enabled.
Format Reg-{D (Disabled discovery)}-S(application region)|L(List of preferred regions)|N(None, user did not configure it).
Default value is "NS".

**[16] `db.operation.parameter`:** If a parameter has no name and instead is referenced only by index, then `<key>` SHOULD be the 0-based index.
If `db.query.text` is also captured, then `db.operation.parameter.<key>` SHOULD match up with the parameterized placeholders present in `db.query.text`.
This attribute has stability level RELEASE CANDIDATE.

The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

Expand Down Expand Up @@ -336,7 +332,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 @@ -348,13 +344,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`,
trask marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -286,18 +278,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 @@ -310,10 +296,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
Loading
Loading