Skip to content

Commit

Permalink
Refine db.operation.name and db.collection.name
Browse files Browse the repository at this point in the history
  • Loading branch information
trask committed Nov 10, 2024
1 parent 273056b commit 514e388
Show file tree
Hide file tree
Showing 17 changed files with 260 additions and 411 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:
17 changes: 5 additions & 12 deletions docs/attributes-registry/db.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,13 @@ This group defines the attributes used to describe telemetry in the context of d

**[1]:** 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
and the collection name is known to always be under the captured `db.namespace`.

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]:** 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 +54,8 @@ This attribute has stability level RELEASE CANDIDATE.
**[4]:** 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
17 changes: 5 additions & 12 deletions docs/database/cassandra.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,13 @@ The Semantic Conventions for [Cassandra](https://cassandra.apache.org/) extend a

**[1]:** 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
and the collection name is known to always be under the captured `db.namespace`.

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]:** 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 +63,8 @@ This attribute has stability level RELEASE CANDIDATE.
**[4]:** 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
41 changes: 16 additions & 25 deletions docs/database/cosmosdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,50 +336,41 @@ 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) |
| [`db.operation.name`](/docs/attributes-registry/db.md) | string | The name of the operation or command being executed. [2] | `findAndModify`; `HMSET`; `SELECT` | `Conditionally Required` [3] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | Database response status code. [4] | `102`; `ORA-17002`; `08P01`; `404` | `Conditionally Required` [5] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`error.type`](/docs/attributes-registry/error.md) | string | Describes a class of error the operation ended with. [6] | `timeout`; `java.net.UnknownHostException`; `server_certificate_invalid`; `500` | `Conditionally Required` If and only if the operation failed. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`server.port`](/docs/attributes-registry/server.md) | int | Server port number. [7] | `80`; `8080`; `443` | `Conditionally Required` [8] | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [9] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | Database response status code. [2] | `102`; `ORA-17002`; `08P01`; `404` | `Conditionally Required` [3] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`error.type`](/docs/attributes-registry/error.md) | string | Describes a class of error the operation ended with. [4] | `timeout`; `java.net.UnknownHostException`; `server_certificate_invalid`; `500` | `Conditionally Required` If and only if the operation failed. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`server.port`](/docs/attributes-registry/server.md) | int | Server port number. [5] | `80`; `8080`; `443` | `Conditionally Required` [6] | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [7] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |

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

**[2]:** 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 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`.

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 `,
otherwise `db.operation.name` SHOULD be `BATCH` or some other database
system specific term if more applicable.
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.

**[3]:** If readily available and if there is a single operation name that describes the database call. The operation name MAY be parsed from the query text, in which case it SHOULD be the single operation name found in the query.

**[4]:** The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.
**[2]:** The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.
Semantic conventions for individual database systems SHOULD document what `db.response.status_code` means in the context of that system.
This attribute has stability level RELEASE CANDIDATE.

**[5]:** If the operation failed and status code is available.
**[3]:** If the operation failed and status code is available.

**[6]:** The `error.type` SHOULD match the `db.response.status_code` returned by the database or the client library, or the canonical name of exception that occurred.
**[4]:** The `error.type` SHOULD match the `db.response.status_code` returned by the database or the client library, or the canonical name of exception that occurred.
When using canonical exception type name, instrumentation SHOULD do the best effort to report the most relevant type. For example, if the original exception is wrapped into a generic one, the original exception SHOULD be preferred.
Instrumentations SHOULD document how `error.type` is populated.

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

**[8]:** If using a port other than the default port for this DBMS and if `server.address` is set.
**[6]:** If using a port other than the default port for this DBMS and if `server.address` is set.

**[9]:** 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.
**[7]:** 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.

The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):
Expand Down
34 changes: 10 additions & 24 deletions docs/database/database-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,13 @@ This attribute has stability level RELEASE CANDIDATE.

**[2]:** 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
and the collection name is known to always be under the captured `db.namespace`.

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]:** 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 +120,8 @@ This attribute has stability level RELEASE CANDIDATE.
**[5]:** 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 @@ -291,18 +284,13 @@ This attribute has stability level RELEASE CANDIDATE.

**[2]:** 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
and the collection name is known to always be under the captured `db.namespace`.

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]:** 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 @@ -315,10 +303,8 @@ This attribute has stability level RELEASE CANDIDATE.
**[5]:** 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
17 changes: 5 additions & 12 deletions docs/database/database-spans.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,13 @@ This attribute has stability level RELEASE CANDIDATE.

**[2]:** 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
and the collection name is known to always be under the captured `db.namespace`.

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]:** 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 +138,8 @@ This attribute has stability level RELEASE CANDIDATE.
**[5]:** 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]:** 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 514e388

Please sign in to comment.