diff --git a/docs/database/cassandra.md b/docs/database/cassandra.md index ea3bdf4546..d21952854e 100644 --- a/docs/database/cassandra.md +++ b/docs/database/cassandra.md @@ -28,7 +28,7 @@ described on this page. | [`network.peer.address`](../attributes-registry/network.md) | string | Peer address of the database node where the operation was performed. [3] | `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | | [`network.peer.port`](../attributes-registry/network.md) | int | Peer port number of the network connection. | `65123` | `Recommended` if and only if `network.peer.address` is set. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | -**[1]:** If readily available. Otherwise, when the instrumentation library supports parsing `db.statement` and it's enabled, `db.collection.name` SHOULD be set to the first table name found in the CQL query. +**[1]:** If readily available. Otherwise, if the instrumentation library parses `db.statement` to capture `db.collection.name`, then it SHOULD be the first collection name found in the query. If the collection name is parsed from the query, it SHOULD match the value provided in the query and may be qualified with the database name. **[2]:** For Cassandra the `db.name` should be set to the Cassandra keyspace name. diff --git a/docs/database/database-spans.md b/docs/database/database-spans.md index 80e93a7138..decb03557a 100644 --- a/docs/database/database-spans.md +++ b/docs/database/database-spans.md @@ -85,7 +85,7 @@ Some database systems may allow a connection to switch to a different `db.user`, | [`network.peer.port`](../attributes-registry/network.md) | int | Peer port number of the network connection. | `65123` | `Recommended` if and only if `network.peer.address` is set. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | | [`server.address`](../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]:** If readily available. Otherwise, when the instrumentation library supports parsing `db.statement` and it's enabled, `db.collection.name` SHOULD be set to the first collection name found in the query. If the collection name is parsed from the query, it SHOULD match the value provided in the query and may be qualified with the database name. +**[1]:** If readily available. Otherwise, if the instrumentation library parses `db.statement` to capture `db.collection.name`, then it SHOULD be the first collection name found in the query. If the collection name is parsed from the query, it SHOULD match the value provided in the query and may be qualified with the database name. **[2]:** In some SQL databases, the database name to be used is called "schema name". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name). diff --git a/docs/database/mssql.md b/docs/database/mssql.md index 71e1ea053f..0e7665af26 100644 --- a/docs/database/mssql.md +++ b/docs/database/mssql.md @@ -21,7 +21,7 @@ described on this page. | [`db.operation.name`](../attributes-registry/db.md) | string | The name of the operation or command being executed. [2] | `SELECT`; `INSERT`; `UPDATE`; `DELETE`; `CREATE`; `mystoredproc` | `Conditionally Required` [3] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`db.mssql.instance_name`](../attributes-registry/db.md) | string | The Microsoft SQL Server [instance name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance. [4] | `MSSQLSERVER` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -**[1]:** If readily available. Otherwise, when the instrumentation library supports parsing `db.statement` and it's enabled, `db.collection.name` SHOULD be set to the first table name found in the SQL query. If the operation is acting upon an anonymous table, this value MUST NOT be set. +**[1]:** If readily available. Otherwise, if the instrumentation library parses `db.statement` to capture `db.collection.name`, then it SHOULD be the first collection name found in the query. If the collection name is parsed from the query, it SHOULD match the value provided in the query and may be qualified with the database name. **[2]:** This SHOULD be the SQL command such as `SELECT`, `INSERT`, `UPDATE`, `CREATE`, `DROP`. In the case of `EXEC`, this SHOULD be the stored procedure name that is being executed. diff --git a/docs/database/sql.md b/docs/database/sql.md index ad39ba0a52..401d82c47e 100644 --- a/docs/database/sql.md +++ b/docs/database/sql.md @@ -18,7 +18,7 @@ described on this page. | [`db.collection.name`](../attributes-registry/db.md) | string | The name of the primary table that the operation is acting upon. | `public.users`; `customers` | `Conditionally Required` [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`db.operation.name`](../attributes-registry/db.md) | string | The name of the operation or command being executed. [2] | `SELECT`; `INSERT`; `UPDATE`; `DELETE`; `CREATE`; `mystoredproc` | `Conditionally Required` [3] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -**[1]:** If readily available. Otherwise, when the instrumentation library supports parsing `db.statement` and it's enabled, `db.collection.name` SHOULD be set to the first table name found in the SQL query. If the operation is acting upon an anonymous table, this value MUST NOT be set. +**[1]:** If readily available. Otherwise, if the instrumentation library parses `db.statement` to capture `db.collection.name`, then it SHOULD be the first collection name found in the query. If the collection name is parsed from the query, it SHOULD match the value provided in the query and may be qualified with the database name. **[2]:** This SHOULD be the SQL command such as `SELECT`, `INSERT`, `UPDATE`, `CREATE`, `DROP`. In the case of `EXEC`, this SHOULD be the stored procedure name that is being executed. diff --git a/model/trace/database.yaml b/model/trace/database.yaml index 9bad152f6f..e5c2c54433 100644 --- a/model/trace/database.yaml +++ b/model/trace/database.yaml @@ -30,8 +30,8 @@ groups: - ref: db.collection.name requirement_level: conditionally_required: > - If readily available. Otherwise, when the instrumentation library supports parsing `db.statement` and it's enabled, - `db.collection.name` SHOULD be set to the first collection name found in the query. + If readily available. Otherwise, if the instrumentation library parses `db.statement` to capture + `db.collection.name`, then it SHOULD be the first collection name found in the query. If the collection name is parsed from the query, it SHOULD match the value provided in the query and may be qualified with the database name. - ref: network.peer.address @@ -94,10 +94,6 @@ groups: tag: tech-specific - ref: db.collection.name brief: The name of the Cassandra table that the operation is acting upon. - requirement_level: - conditionally_required: > - If readily available. Otherwise, when the instrumentation library supports parsing `db.statement` and it's enabled, - `db.collection.name` SHOULD be set to the first table name found in the CQL query. tag: tech-specific - ref: db.cassandra.idempotence tag: tech-specific @@ -237,11 +233,6 @@ groups: tag: tech-specific - ref: db.collection.name brief: The name of the primary table that the operation is acting upon. - requirement_level: - conditionally_required: > - If readily available. Otherwise, when the instrumentation library supports parsing `db.statement` and it's enabled, - `db.collection.name` SHOULD be set to the first table name found in the SQL query. - If the operation is acting upon an anonymous table, this value MUST NOT be set. tag: tech-specific - id: db.cosmosdb