diff --git a/.chloggen/1863.yaml b/.chloggen/1863.yaml
new file mode 100644
index 000000000..68b1413aa
--- /dev/null
+++ b/.chloggen/1863.yaml
@@ -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]
diff --git a/docs/attributes-registry/db.md b/docs/attributes-registry/db.md
index 4d4db8d81..115714340 100644
--- a/docs/attributes-registry/db.md
+++ b/docs/attributes-registry/db.md
@@ -26,13 +26,14 @@ This group defines the attributes used to describe telemetry in the context of d
| `db.response.status_code` | string | Database response status code. [8] | `102`; `ORA-17002`; `08P01`; `404` |  |
| `db.system.name` | string | The database management system (DBMS) product as identified by the client instrumentation. [9] | `other_sql`; `softwareag.adabas`; `actian.ingres` |  |
-**[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 `,
diff --git a/docs/database/cassandra.md b/docs/database/cassandra.md
index e6b6dab7d..697ba36d1 100644
--- a/docs/database/cassandra.md
+++ b/docs/database/cassandra.md
@@ -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` |  |
| [`db.operation.parameter.`](/docs/attributes-registry/db.md) | string | A database operation parameter, with `` being the parameter name, and the attribute value being a string representation of the parameter value. [18] | `someval`; `55` | `Opt-In` |  |
-**[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.
diff --git a/docs/database/cosmosdb.md b/docs/database/cosmosdb.md
index 907214f0e..5018e2156 100644
--- a/docs/database/cosmosdb.md
+++ b/docs/database/cosmosdb.md
@@ -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. |  |
| [`db.collection.name`](/docs/attributes-registry/db.md) | string | Cosmos DB container name. [1] | `public.users`; `customers` | `Conditionally Required` If available. |  |
| [`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. |  |
-| [`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] |  |
-| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | Database response status code. [4] | `102`; `ORA-17002`; `08P01`; `404` | `Conditionally Required` [5] |  |
-| [`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. |  |
-| [`server.port`](/docs/attributes-registry/server.md) | int | Server port number. [7] | `80`; `8080`; `443` | `Conditionally Required` [8] |  |
-| [`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 |  |
-| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [10] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
+| [`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. |  |
+| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | Database response status code. [3] | `102`; `ORA-17002`; `08P01`; `404` | `Conditionally Required` [4] |  |
+| [`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. |  |
+| [`server.port`](/docs/attributes-registry/server.md) | int | Server port number. [6] | `80`; `8080`; `443` | `Conditionally Required` [7] |  |
+| [`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 |  |
+| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [9] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
**[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.
---
diff --git a/docs/database/database-metrics.md b/docs/database/database-metrics.md
index dd241b8e7..f48306e79 100644
--- a/docs/database/database-metrics.md
+++ b/docs/database/database-metrics.md
@@ -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.
diff --git a/docs/database/database-spans.md b/docs/database/database-spans.md
index 7bd1b0f29..fb0ef9408 100644
--- a/docs/database/database-spans.md
+++ b/docs/database/database-spans.md
@@ -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.
diff --git a/docs/database/elasticsearch.md b/docs/database/elasticsearch.md
index c4d1a899c..28d02f2f1 100644
--- a/docs/database/elasticsearch.md
+++ b/docs/database/elasticsearch.md
@@ -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` |  |
**[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)
diff --git a/docs/database/hbase.md b/docs/database/hbase.md
index 446196167..14682bee0 100644
--- a/docs/database/hbase.md
+++ b/docs/database/hbase.md
@@ -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` |  |
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [9] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
-**[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.
diff --git a/docs/database/mongodb.md b/docs/database/mongodb.md
index d019a6815..7b07d25e4 100644
--- a/docs/database/mongodb.md
+++ b/docs/database/mongodb.md
@@ -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` |  |
| [`db.namespace`](/docs/attributes-registry/db.md) | string | The MongoDB database name. | `customers`; `test.users` | `Conditionally Required` If available. |  |
-| [`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. |  |
-| [`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] |  |
-| [`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. |  |
-| [`server.port`](/docs/attributes-registry/server.md) | int | Server port number. [6] | `80`; `8080`; `443` | `Conditionally Required` [7] |  |
-| [`db.operation.batch.size`](/docs/attributes-registry/db.md) | int | The number of queries included in a batch operation. [8] | `2`; `3`; `4` | `Recommended` |  |
-| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [9] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
+| [`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. |  |
+| [`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] |  |
+| [`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. |  |
+| [`server.port`](/docs/attributes-registry/server.md) | int | Server port number. [5] | `80`; `8080`; `443` | `Conditionally Required` [6] |  |
+| [`db.operation.batch.size`](/docs/attributes-registry/db.md) | int | The number of queries included in a batch operation. [7] | `2`; `3`; `4` | `Recommended` |  |
+| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [8] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
**[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):
diff --git a/docs/database/redis.md b/docs/database/redis.md
index 7e82e27d1..e126351f3 100644
--- a/docs/database/redis.md
+++ b/docs/database/redis.md
@@ -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. |  |
-| [`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] |  |
+| [`db.operation.name`](/docs/attributes-registry/db.md) | string | The Redis command name. [2] | `HMSET`; `GET`; `SET` | `Conditionally Required` [3] |  |
| [`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] |  |
| [`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. |  |
| [`server.port`](/docs/attributes-registry/server.md) | int | Server port number. [7] | `80`; `8080`; `443` | `Conditionally Required` [8] |  |
@@ -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"` |
diff --git a/model/azure/cosmosdb-metrics.yaml b/model/azure/cosmosdb-metrics.yaml
index 05996fe46..f2eec6e23 100644
--- a/model/azure/cosmosdb-metrics.yaml
+++ b/model/azure/cosmosdb-metrics.yaml
@@ -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
diff --git a/model/database/common.yaml b/model/database/common.yaml
index 7dc001df5..c8ed755bd 100644
--- a/model/database/common.yaml
+++ b/model/database/common.yaml
@@ -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.
diff --git a/model/database/registry.yaml b/model/database/registry.yaml
index 0612cad92..dc4507bc5 100644
--- a/model/database/registry.yaml
+++ b/model/database/registry.yaml
@@ -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 `,
diff --git a/model/database/spans.yaml b/model/database/spans.yaml
index 7bbe1bd47..ff6d99db1 100644
--- a/model/database/spans.yaml
+++ b/model/database/spans.yaml
@@ -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