Clarify notes on system-specific databases for operation and collection names (#1863)

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
This commit is contained in:
Liudmila Molkova 2025-02-19 18:38:37 -08:00 committed by GitHub
parent c863656856
commit d963d60dc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 133 additions and 126 deletions

6
.chloggen/1863.yaml Normal file
View File

@ -0,0 +1,6 @@
change_type: enhancement
component: db
note: Add database-specific notes on db.operation.name and db.collection.name for
Cassandra, Cosmos DB, HBase, MongoDB, and Redis, covering their batch/bulk
terms and lack of cross-table queries.
issues: [1863, 1573]

View File

@ -26,13 +26,14 @@ This group defines the attributes used to describe telemetry in the context of d
| <a id="db-response-status-code" href="#db-response-status-code">`db.response.status_code`</a> | string | Database response status code. [8] | `102`; `ORA-17002`; `08P01`; `404` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| <a id="db-system-name" href="#db-system-name">`db.system.name`</a> | string | The database management system (DBMS) product as identified by the client instrumentation. [9] | `other_sql`; `softwareag.adabas`; `actian.ingres` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
**[1] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
**[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.
when the database system supports cross-table queries in non-batch operations.
For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.
For batch operations, if the individual operations are known to have the same
collection name then that collection name SHOULD be used.
**[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.
Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system.
@ -44,7 +45,7 @@ It is RECOMMENDED to capture the value as provided by the application without at
without attempting to do any case normalization.
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.
when the database system supports cross-table queries in non-batch operations.
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 `,

View File

@ -53,15 +53,13 @@ The following table outlines the span attributes applicable to Cassandra.
| [`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` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
**[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.
**[1] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.
For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.
**[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.
**[2] `db.collection.name`:** If readily available and if a database call is performed on a single collection.
**[3] `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.
Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system.
@ -71,14 +69,14 @@ It is RECOMMENDED to capture the value as provided by the application without at
without attempting to do any case normalization.
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.
when the database system supports cross-table queries in non-batch operations.
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.
**[5] `db.operation.name`:** 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.
**[5] `db.operation.name`:** If readily available and if there is a single operation name that describes the database call.
**[6] `db.response.status_code`:** All Cassandra protocol error codes SHOULD be considered errors.

View File

@ -193,7 +193,7 @@ If none of them applies, it's RECOMMENDED to use language-agnostic representatio
client method name in snake_case. Instrumentations SHOULD document
additional values when introducing new operations.
**[5] `db.operation.name`:** 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.
**[5] `db.operation.name`:** If readily available and if there is a single operation name that describes the database call.
**[6] `db.response.status_code`:** Response codes in the 4xx and 5xx range SHOULD be considered errors.
@ -345,50 +345,42 @@ Explaining bucket configuration:
| [`azure.cosmosdb.response.sub_status_code`](/docs/attributes-registry/azure.md) | int | Cosmos DB sub status code. | `1000`; `1002` | `Conditionally Required` when response was received and contained sub-code. | ![Development](https://img.shields.io/badge/-development-blue) |
| [`db.collection.name`](/docs/attributes-registry/db.md) | string | Cosmos DB container name. [1] | `public.users`; `customers` | `Conditionally Required` If available. | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`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. | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`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] | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | Database response status code. [4] | `102`; `ORA-17002`; `08P01`; `404` | `Conditionally Required` [5] | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`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) |
| [`azure.cosmosdb.operation.contacted_regions`](/docs/attributes-registry/azure.md) | string[] | List of regions contacted during operation in the order that they were contacted. If there is more than one region listed, it indicates that the operation was performed on multiple regions i.e. cross-regional call. [9] | `["North Central US", "Australia East", "Australia Southeast"]` | `Recommended` If available | ![Development](https://img.shields.io/badge/-development-blue) |
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [10] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`db.operation.name`](/docs/attributes-registry/db.md) | string | The name of the operation or command being executed. [2] | `findAndModify`; `HMSET`; `SELECT` | `Conditionally Required` If readily available. | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | Database response status code. [3] | `102`; `ORA-17002`; `08P01`; `404` | `Conditionally Required` [4] | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`error.type`](/docs/attributes-registry/error.md) | string | Describes a class of error the operation ended with. [5] | `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. [6] | `80`; `8080`; `443` | `Conditionally Required` [7] | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`azure.cosmosdb.operation.contacted_regions`](/docs/attributes-registry/azure.md) | string[] | List of regions contacted during operation in the order that they were contacted. If there is more than one region listed, it indicates that the operation was performed on multiple regions i.e. cross-regional call. [8] | `["North Central US", "Australia East", "Australia Southeast"]` | `Recommended` If available | ![Development](https://img.shields.io/badge/-development-blue) |
| [`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) |
**[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.
**[2] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.
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.
when the database system supports cross-table queries in non-batch operations.
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.
**[3] `db.operation.name`:** 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] `db.response.status_code`:** 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.
**[3] `db.response.status_code`:** 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.
**[5] `db.response.status_code`:** If the operation failed and status code is available.
**[4] `db.response.status_code`:** If the operation failed and status code is available.
**[6] `error.type`:** 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.
**[5] `error.type`:** 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] `server.port`:** 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.
**[6] `server.port`:** 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] `server.port`:** If using a port other than the default port for this DBMS and if `server.address` is set.
**[7] `server.port`:** If using a port other than the default port for this DBMS and if `server.address` is set.
**[9] `azure.cosmosdb.operation.contacted_regions`:** Region name matches the format of `displayName` in [Azure Location API](https://learn.microsoft.com/rest/api/subscription/subscriptions/list-locations?view=rest-subscription-2021-10-01&tabs=HTTP#location)
**[8] `azure.cosmosdb.operation.contacted_regions`:** Region name matches the format of `displayName` in [Azure Location API](https://learn.microsoft.com/rest/api/subscription/subscriptions/list-locations?view=rest-subscription-2021-10-01&tabs=HTTP#location)
**[10] `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.
**[9] `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.
---

View File

@ -96,15 +96,16 @@ of `[ 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 5, 10 ]`.
**[1] `db.system.name`:** The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system.name` is set to `postgresql` based on the instrumentation's best knowledge.
**[2] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
**[2] `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.
when the database system supports cross-table queries in non-batch operations.
For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.
For batch operations, if the individual operations are known to have the same
collection name then that collection name SHOULD be used.
**[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.
**[3] `db.collection.name`:** If readily available and if a database call is performed on a single collection.
**[4] `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.
Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system.
@ -114,14 +115,14 @@ It is RECOMMENDED to capture the value as provided by the application without at
without attempting to do any case normalization.
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.
when the database system supports cross-table queries in non-batch operations.
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.
**[6] `db.operation.name`:** 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.
**[6] `db.operation.name`:** If readily available and if there is a single operation name that describes the database call.
**[7] `db.response.status_code`:** 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.
@ -262,15 +263,16 @@ Explaining bucket configuration:
**[1] `db.system.name`:** The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system.name` is set to `postgresql` based on the instrumentation's best knowledge.
**[2] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
**[2] `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.
when the database system supports cross-table queries in non-batch operations.
For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.
For batch operations, if the individual operations are known to have the same
collection name then that collection name SHOULD be used.
**[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.
**[3] `db.collection.name`:** If readily available and if a database call is performed on a single collection.
**[4] `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.
Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system.
@ -280,14 +282,14 @@ It is RECOMMENDED to capture the value as provided by the application without at
without attempting to do any case normalization.
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.
when the database system supports cross-table queries in non-batch operations.
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.
**[6] `db.operation.name`:** 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.
**[6] `db.operation.name`:** If readily available and if there is a single operation name that describes the database call.
**[7] `db.response.status_code`:** 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.

View File

@ -123,15 +123,16 @@ These attributes are commonly used across different database systems.
**[1] `db.system.name`:** The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system.name` is set to `postgresql` based on the instrumentation's best knowledge.
**[2] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
**[2] `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.
when the database system supports cross-table queries in non-batch operations.
For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.
For batch operations, if the individual operations are known to have the same
collection name then that collection name SHOULD be used.
**[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.
**[3] `db.collection.name`:** If readily available and if a database call is performed on a single collection.
**[4] `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.
Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system.
@ -141,14 +142,14 @@ It is RECOMMENDED to capture the value as provided by the application without at
without attempting to do any case normalization.
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.
when the database system supports cross-table queries in non-batch operations.
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.
**[6] `db.operation.name`:** 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.
**[6] `db.operation.name`:** If readily available and if there is a single operation name that describes the database call.
**[7] `db.response.status_code`:** 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.

View File

@ -50,6 +50,7 @@ The following table outlines the span attributes applicable to Elasticsearch.
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [15] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
**[1] `db.operation.name`:** The `db.operation.name` SHOULD match the endpoint identifier provided in the request (see the [Elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json)).
For batch operations, if the individual operations are known to have the same operation name then that operation name SHOULD be used prepended by `bulk `, otherwise `db.operation.name` SHOULD be `bulk`.
**[2] `http.request.method`:** HTTP request method value SHOULD be "known" to the instrumentation.
By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)

View File

@ -41,7 +41,7 @@ The following table outlines the span attributes applicable to HBase.
| [`db.operation.batch.size`](/docs/attributes-registry/db.md) | int | The number of queries included in a batch operation. [8] | `2`; `3`; `4` | `Recommended` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`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) |
**[1] `db.collection.name`:** If table name includes the namespace, the `db.collection.name` SHOULD be set to the full table name.
**[1] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization. If table name includes the namespace, the `db.collection.name` SHOULD be set to the full table name.
**[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.
Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system.
@ -50,13 +50,9 @@ It is RECOMMENDED to capture the value as provided by the application without at
**[3] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.
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 `,
otherwise `db.operation.name` SHOULD be `BATCH` or some other database
system specific term if more applicable.
otherwise `db.operation.name` SHOULD be `BATCH`.
**[4] `db.response.status_code`:** 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.

View File

@ -38,38 +38,31 @@ The following table outlines the span attributes applicable to MongoDB.
|---|---|---|---|---|---|
| [`db.collection.name`](/docs/attributes-registry/db.md) | string | The MongoDB collection being accessed within the database stated in `db.namespace`. [1] | `public.users`; `customers` | `Required` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`db.namespace`](/docs/attributes-registry/db.md) | string | The MongoDB database name. | `customers`; `test.users` | `Conditionally Required` If available. | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`db.operation.name`](/docs/attributes-registry/db.md) | string | The name of the command being executed. [2] | `findAndModify`; `getMore`; `update` | `Conditionally Required` If readily available. | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | [MongoDB error code](https://www.mongodb.com/docs/manual/reference/error-codes/) represented as a string. [3] | `36`; `11602` | `Conditionally Required` [4] | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`error.type`](/docs/attributes-registry/error.md) | string | Describes a class of error the operation ended with. [5] | `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. [6] | `80`; `8080`; `443` | `Conditionally Required` [7] | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`db.operation.batch.size`](/docs/attributes-registry/db.md) | int | The number of queries included in a batch operation. [8] | `2`; `3`; `4` | `Recommended` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`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.operation.name`](/docs/attributes-registry/db.md) | string | The name of the [MongoDB command](https://www.mongodb.com/docs/manual/reference/command/) being executed. | `findAndModify`; `getMore`; `insertMany`; `bulkWrite` | `Conditionally Required` If readily available. | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | [MongoDB error code](https://www.mongodb.com/docs/manual/reference/error-codes/) represented as a string. [2] | `36`; `11602` | `Conditionally Required` [3] | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`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) |
| [`db.operation.batch.size`](/docs/attributes-registry/db.md) | int | The number of queries included in a batch operation. [7] | `2`; `3`; `4` | `Recommended` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [8] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
**[1] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
For batch operations, if the individual operations are known to have the same collection name then that collection name SHOULD be used.
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.
**[2] `db.response.status_code`:** All MongoDB error codes SHOULD be considered errors.
For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.
**[3] `db.response.status_code`:** If the operation failed and error code is available.
**[2] `db.operation.name`:** See [MongoDB database commands](https://www.mongodb.com/docs/manual/reference/command/).
**[3] `db.response.status_code`:** All MongoDB error codes SHOULD be considered errors.
**[4] `db.response.status_code`:** If the operation failed and error code is available.
**[5] `error.type`:** 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] `error.type`:** 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.
**[6] `server.port`:** 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] `server.port`:** 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.
**[7] `server.port`:** If using a port other than the default port for this DBMS and if `server.address` is set.
**[6] `server.port`:** If using a port other than the default port for this DBMS and if `server.address` is set.
**[8] `db.operation.batch.size`:** Operations are only considered batches when they contain two or more operations, and so `db.operation.batch.size` SHOULD never be `1`.
**[7] `db.operation.batch.size`:** Operations are only considered batches when they contain two or more operations, and so `db.operation.batch.size` SHOULD never be `1`.
**[9] `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.
**[8] `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.
The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

View File

@ -28,7 +28,7 @@ looking confusing.
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`db.namespace`](/docs/attributes-registry/db.md) | string | The [database index] associated with the connection, represented as a string. [1] | `0`; `1`; `15` | `Conditionally Required` If and only if it can be captured reliably. | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`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] | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`db.operation.name`](/docs/attributes-registry/db.md) | string | The Redis command name. [2] | `HMSET`; `GET`; `SET` | `Conditionally Required` [3] | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | The Redis [simple error](https://redis.io/docs/latest/develop/reference/protocol-spec/#simple-errors) prefix. [4] | `ERR`; `WRONGTYPE`; `CLUSTERDOWN` | `Conditionally Required` [5] | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
| [`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) |
@ -47,18 +47,10 @@ then it is RECOMMENDED to fallback and use the database index provided when the
Instrumentation SHOULD document if `db.namespace` reflects the database index provided when the connection was established.
**[2] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.
**[2] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
For [transactions and pipelined calls](https://redis.io/docs/latest/develop/clients/redis-py/transpipe/), if the individual operations are known to have the same command then that command SHOULD be used prepended by `MULTI ` or `PIPELINE `. Otherwise `db.operation.name` SHOULD be `MULTI` or `PIPELINE`.
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 `,
otherwise `db.operation.name` SHOULD be `BATCH` or some other database
system specific term if more applicable.
**[3] `db.operation.name`:** 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.
**[3] `db.operation.name`:** If readily available and if there is a single operation name that describes the database call.
**[4] `db.response.status_code`:** All Redis error prefixes SHOULD be considered errors.
@ -115,7 +107,7 @@ In this example, Redis is connected using a unix domain socket and therefore the
| Key | Value |
|:--------------------------| :-------------------------------------------- |
| Span name | `"HMSET 15"` |
| Span name | `"HMSET"` |
| `db.system.name` | `"redis"` |
| `network.peer.address` | `"/tmp/redis.sock"` |
| `network.transport` | `"unix"` |

View File

@ -11,6 +11,11 @@ groups:
- ref: azure.cosmosdb.operation.contacted_regions
requirement_level:
recommended: If available
- ref: db.collection.name
brief: >
Cosmos DB container name.
note: >
It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
- id: metric.azure.cosmosdb.client.active_instance.count
type: metric

View File

@ -2,7 +2,6 @@ groups:
- id: attributes.db.client.minimal
type: attribute_group
brief: 'Database Client attributes'
stability: development
attributes:
- ref: server.address
brief: >
@ -37,11 +36,8 @@ groups:
# requirement_level:
# conditionally_required: if available
- ref: db.operation.name
requirement_level: # TODO (trask) simplify
conditionally_required: >
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.
requirement_level:
conditionally_required: If readily available.
- ref: db.collection.name
brief: Cosmos DB container name.
requirement_level:
@ -60,7 +56,6 @@ groups:
- id: attributes.db.client.with_query
extends: attributes.db.client.minimal
type: attribute_group
stability: development
brief: This group defines the attributes describing database operations that
may have queries.
attributes:
@ -72,19 +67,15 @@ groups:
- id: attributes.db.client.with_query_and_collection
extends: attributes.db.client.with_query
type: attribute_group
stability: development
brief: This group defines the attributes describing database operations that
have operation name, collection name and query.
attributes:
- ref: db.operation.name
requirement_level: # TODO (trask) simplify
requirement_level:
conditionally_required: >
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.
database call.
- ref: db.collection.name
requirement_level: # TODO (trask) simplify
requirement_level:
conditionally_required: >
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.

View File

@ -10,13 +10,14 @@ groups:
stability: release_candidate
brief: The name of a collection (table, container) within the database.
note: |
It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
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.
when the database system supports cross-table queries in non-batch operations.
For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.
For batch operations, if the individual operations are known to have the same
collection name then that collection name SHOULD be used.
examples: ["public.users", "customers"]
- id: db.namespace
type: string
@ -44,7 +45,7 @@ groups:
without attempting to do any case normalization.
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.
when the database system supports cross-table queries in non-batch operations.
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 `,

View File

@ -2,7 +2,6 @@ groups:
- id: trace.db.common.minimal
extends: attributes.db.client.minimal
type: attribute_group
stability: development
brief: This group defines the attributes used to perform database client calls.
attributes:
# TODO: add db.system once https://github.com/open-telemetry/build-tools/issues/192 is possible
@ -10,11 +9,10 @@ groups:
# sampling_relevant: true
- ref: db.operation.name
sampling_relevant: true
requirement_level: # TODO (trask) simplify
requirement_level:
conditionally_required: >
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.
database call.
- ref: db.operation.batch.size
- ref: server.address
sampling_relevant: true
@ -24,7 +22,6 @@ groups:
- id: trace.db.common.query
extends: attributes.db.client.with_query
type: attribute_group
stability: development
brief: This group defines the attributes used to perform database client calls.
attributes:
- ref: server.address
@ -52,7 +49,6 @@ groups:
- id: trace.db.common.query_and_collection
extends: attributes.db.client.with_query_and_collection
type: attribute_group
stability: development
brief: This group defines the attributes used to perform database client calls.
attributes:
- ref: db.collection.name
@ -83,7 +79,6 @@ groups:
- id: trace.db.common.full
type: attribute_group
stability: development
brief: This group documents attributes that describe database call along with network information.
extends: trace.db.common.query_and_collection
attributes:
@ -276,6 +271,12 @@ groups:
- ref: cassandra.consistency.level
- ref: db.collection.name
brief: The name of the Cassandra table that the operation is acting upon.
note: |
It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.
For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.
- ref: cassandra.query.idempotent
- ref: cassandra.speculative_execution.count
- ref: cassandra.coordinator.id
@ -315,9 +316,17 @@ groups:
requirement_level:
conditionally_required: If applicable.
note: >
It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
If table name includes the namespace, the `db.collection.name` SHOULD be set to the full table name.
examples: ['mytable', 'ns:table']
- ref: db.operation.name
note: |
It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.
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`.
requirement_level:
conditionally_required: If readily available.
- ref: db.response.status_code
@ -385,6 +394,17 @@ groups:
Instrumentation SHOULD document if `db.namespace` reflects the database index provided when the connection was established.
examples: ["0", "1", "15"]
- ref: db.operation.name
brief: >
The Redis command name.
examples: ["HMSET", "GET", "SET"]
note: >
It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.
For [transactions and pipelined calls](https://redis.io/docs/latest/develop/clients/redis-py/transpipe/),
if the individual operations are known to have the same command then that
command SHOULD be used prepended by `MULTI ` or `PIPELINE `.
Otherwise `db.operation.name` SHOULD be `MULTI` or `PIPELINE`.
sampling_relevant: true
- ref: db.query.text
sampling_relevant: true
@ -438,16 +458,20 @@ groups:
- ref: db.operation.name
sampling_relevant: true
brief: >
The name of the command being executed.
note: >
See [MongoDB database commands](https://www.mongodb.com/docs/manual/reference/command/).
examples: ['findAndModify', 'getMore', 'update']
The name of the [MongoDB command](https://www.mongodb.com/docs/manual/reference/command/) being executed.
note: ""
examples: ['findAndModify', 'getMore', 'insertMany', 'bulkWrite']
requirement_level:
conditionally_required: If readily available.
- ref: db.collection.name
sampling_relevant: true
brief:
The MongoDB collection being accessed within the database stated in `db.namespace`.
note: >
It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
For batch operations, if the individual operations are known to have the same collection name
then that collection name SHOULD be used.
requirement_level: required
- ref: db.namespace
sampling_relevant: true
@ -480,6 +504,10 @@ groups:
note: >
The `db.operation.name` SHOULD match the endpoint identifier provided in the request
(see the [Elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json)).
For batch operations, if the individual operations are known to have the same operation name
then that operation name SHOULD be used prepended by `bulk `,
otherwise `db.operation.name` SHOULD be `bulk`.
examples: [ 'search', 'ml.close_job', 'cat.aliases' ]
- ref: url.full
sampling_relevant: true