Make db.operation.name required where it's available, clarify what to do with multiple layers (#2200)
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
This commit is contained in:
parent
4a023fc5a7
commit
0268189395
|
|
@ -0,0 +1,4 @@
|
|||
change_type: enhancement
|
||||
component: db
|
||||
note: Make `db.operation.name` required where it's available, add recommendation for instrumentation point.
|
||||
issues: [2200, 2098]
|
||||
|
|
@ -47,36 +47,30 @@ Semantic conventions described in this document apply to the call-level spans on
|
|||
|
||||
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
||||
|---|---|---|---|---|---|
|
||||
| [`azure.cosmosdb.connection.mode`](/docs/attributes-registry/azure.md) | string | Cosmos client connection mode. | `gateway`; `direct` | `Conditionally Required` [1] |  |
|
||||
| [`db.operation.name`](/docs/attributes-registry/db.md) | string | The name of the operation or command being executed. [1] | `create_item`; `query_items`; `read_item` | `Required` |  |
|
||||
| [`azure.cosmosdb.connection.mode`](/docs/attributes-registry/azure.md) | string | Cosmos client connection mode. | `gateway`; `direct` | `Conditionally Required` [2] |  |
|
||||
| [`azure.cosmosdb.consistency.level`](/docs/attributes-registry/azure.md) | string | Account or request [consistency level](https://learn.microsoft.com/azure/cosmos-db/consistency-levels). | `Eventual`; `ConsistentPrefix`; `BoundedStaleness`; `Strong`; `Session` | `Conditionally Required` If available. |  |
|
||||
| [`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. [2] | `["North Central US", "Australia East", "Australia Southeast"]` | `Conditionally Required` If available. |  |
|
||||
| [`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. [3] | `["North Central US", "Australia East", "Australia Southeast"]` | `Conditionally Required` If available. |  |
|
||||
| [`azure.cosmosdb.operation.request_charge`](/docs/attributes-registry/azure.md) | double | The number of request units consumed by the operation. | `46.18`; `1.0` | `Conditionally Required` when available |  |
|
||||
| [`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. [3] | `public.users`; `customers` | `Conditionally Required` if available |  |
|
||||
| [`db.collection.name`](/docs/attributes-registry/db.md) | string | Cosmos DB container name. [4] | `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. [4] | `create_item`; `query_items`; `read_item` | `Conditionally Required` [5] |  |
|
||||
| [`db.response.returned_rows`](/docs/attributes-registry/db.md) | int | Cosmos DB row count in result set. | `10`; `20` | `Conditionally Required` if response was received and returned any rows |  |
|
||||
| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | Cosmos DB status code. [6] | `200`; `201` | `Conditionally Required` if response was received |  |
|
||||
| [`error.type`](/docs/attributes-registry/error.md) | string | Describes a class of error the operation ended with. [7] | `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. [8] | `80`; `8080`; `443` | `Conditionally Required` If not default (443). |  |
|
||||
| [`az.namespace`](/docs/attributes-registry/azure.md) | string | [Azure Resource Provider Namespace](https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers) as recognized by the client. [9] | `Microsoft.DocumentDB` | `Recommended` |  |
|
||||
| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | Cosmos DB status code. [5] | `200`; `201` | `Conditionally Required` if response was received |  |
|
||||
| [`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` If not default (443). |  |
|
||||
| [`az.namespace`](/docs/attributes-registry/azure.md) | string | [Azure Resource Provider Namespace](https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers) as recognized by the client. [8] | `Microsoft.DocumentDB` | `Recommended` |  |
|
||||
| [`azure.client.id`](/docs/attributes-registry/azure.md) | string | The unique identifier of the client instance. | `3ba4827d-4422-483f-b59f-85b74211c11d`; `storage-client-1` | `Recommended` |  |
|
||||
| [`azure.cosmosdb.request.body.size`](/docs/attributes-registry/azure.md) | int | Request payload size in bytes. | | `Recommended` |  |
|
||||
| [`db.operation.batch.size`](/docs/attributes-registry/db.md) | int | The number of queries included in a batch operation. [10] | `2`; `3`; `4` | `Recommended` |  |
|
||||
| [`db.query.summary`](/docs/attributes-registry/db.md) | string | Low cardinality representation of a database query text. [11] | `SELECT wuser_table`; `INSERT shipping_details SELECT orders`; `get user by id` | `Recommended` [12] |  |
|
||||
| [`db.query.text`](/docs/attributes-registry/db.md) | string | The database query being executed. [13] | `SELECT * FROM wuser_table where username = ?`; `SET mykey ?` | `Recommended` [14] |  |
|
||||
| [`db.stored_procedure.name`](/docs/attributes-registry/db.md) | string | The name of a stored procedure within the database. [15] | `GetCustomer` | `Recommended` [16] |  |
|
||||
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [17] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
|
||||
| [`user_agent.original`](/docs/attributes-registry/user-agent.md) | string | Full user-agent string is generated by Cosmos DB SDK [18] | `cosmos-netstandard-sdk/3.23.0\|3.23.1\|1\|X64\|Linux 5.4.0-1098-azure 104 18\|.NET Core 3.1.32\|S\|` | `Recommended` |  |
|
||||
| [`db.query.parameter.<key>`](/docs/attributes-registry/db.md) | string | A database query parameter, with `<key>` being the parameter name, and the attribute value being a string representation of the parameter value. [19] | `someval`; `55` | `Opt-In` |  |
|
||||
| [`db.operation.batch.size`](/docs/attributes-registry/db.md) | int | The number of queries included in a batch operation. [9] | `2`; `3`; `4` | `Recommended` |  |
|
||||
| [`db.query.summary`](/docs/attributes-registry/db.md) | string | Low cardinality representation of a database query text. [10] | `SELECT wuser_table`; `INSERT shipping_details SELECT orders`; `get user by id` | `Recommended` [11] |  |
|
||||
| [`db.query.text`](/docs/attributes-registry/db.md) | string | The database query being executed. [12] | `SELECT * FROM wuser_table where username = ?`; `SET mykey ?` | `Recommended` [13] |  |
|
||||
| [`db.stored_procedure.name`](/docs/attributes-registry/db.md) | string | The name of a stored procedure within the database. [14] | `GetCustomer` | `Recommended` [15] |  |
|
||||
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [16] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
|
||||
| [`user_agent.original`](/docs/attributes-registry/user-agent.md) | string | Full user-agent string is generated by Cosmos DB SDK [17] | `cosmos-netstandard-sdk/3.23.0\|3.23.1\|1\|X64\|Linux 5.4.0-1098-azure 104 18\|.NET Core 3.1.32\|S\|` | `Recommended` |  |
|
||||
| [`db.query.parameter.<key>`](/docs/attributes-registry/db.md) | string | A database query parameter, with `<key>` being the parameter name, and the attribute value being a string representation of the parameter value. [18] | `someval`; `55` | `Opt-In` |  |
|
||||
|
||||
**[1] `azure.cosmosdb.connection.mode`:** if not `gateway` (the default value is assumed to be `gateway`).
|
||||
|
||||
**[2] `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)
|
||||
|
||||
**[3] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
|
||||
|
||||
**[4] `db.operation.name`:** The `db.operation.name` has the following list of well-known values.
|
||||
**[1] `db.operation.name`:** The `db.operation.name` has the following list of well-known values.
|
||||
If one of them applies, then the respective value MUST be used.
|
||||
|
||||
Batch operations:
|
||||
|
|
@ -200,47 +194,51 @@ 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.
|
||||
**[2] `azure.cosmosdb.connection.mode`:** if not `gateway` (the default value is assumed to be `gateway`).
|
||||
|
||||
**[6] `db.response.status_code`:** Response codes in the 4xx and 5xx range SHOULD be considered errors.
|
||||
**[3] `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)
|
||||
|
||||
**[7] `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] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
|
||||
|
||||
**[5] `db.response.status_code`:** Response codes in the 4xx and 5xx range SHOULD be considered errors.
|
||||
|
||||
**[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.
|
||||
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.
|
||||
|
||||
**[8] `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`:** 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.
|
||||
|
||||
**[9] `az.namespace`:** When `az.namespace` attribute is populated, it MUST be set to `Microsoft.DocumentDB` for all operations performed by Cosmos DB client.
|
||||
**[8] `az.namespace`:** When `az.namespace` attribute is populated, it MUST be set to `Microsoft.DocumentDB` for all operations performed by Cosmos DB client.
|
||||
|
||||
**[10] `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] `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`.
|
||||
|
||||
**[11] `db.query.summary`:** `db.query.summary` provides static summary of the query text. It describes a class of database queries and is useful as a grouping key, especially when analyzing telemetry for database calls involving complex queries.
|
||||
**[10] `db.query.summary`:** `db.query.summary` provides static summary of the query text. It describes a class of database queries and is useful as a grouping key, especially when analyzing telemetry for database calls involving complex queries.
|
||||
Summary may be available to the instrumentation through instrumentation hooks or other means. If it is not available, instrumentations that support query parsing SHOULD generate a summary following [Generating query summary](/docs/database/database-spans.md#generating-a-summary-of-the-query-text) section.
|
||||
|
||||
**[12] `db.query.summary`:** if readily available or if instrumentation supports query summarization.
|
||||
**[11] `db.query.summary`:** if readily available or if instrumentation supports query summarization.
|
||||
|
||||
**[13] `db.query.text`:** For sanitization see [Sanitization of `db.query.text`](/docs/database/database-spans.md#sanitization-of-dbquerytext).
|
||||
**[12] `db.query.text`:** For sanitization see [Sanitization of `db.query.text`](/docs/database/database-spans.md#sanitization-of-dbquerytext).
|
||||
For batch operations, if the individual operations are known to have the same query text then that query text SHOULD be used, otherwise all of the individual query texts SHOULD be concatenated with separator `; ` or some other database system specific separator if more applicable.
|
||||
Parameterized query text SHOULD NOT be sanitized. Even though parameterized query text can potentially have sensitive data, by using a parameterized query the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit to observability of capturing the static part of the query text by default outweighs the risk.
|
||||
|
||||
**[14] `db.query.text`:** Non-parameterized query text SHOULD NOT be collected by default unless there is sanitization that excludes sensitive data, e.g. by redacting all literal values present in the query text. See [Sanitization of `db.query.text`](/docs/database/database-spans.md#sanitization-of-dbquerytext).
|
||||
**[13] `db.query.text`:** Non-parameterized query text SHOULD NOT be collected by default unless there is sanitization that excludes sensitive data, e.g. by redacting all literal values present in the query text. See [Sanitization of `db.query.text`](/docs/database/database-spans.md#sanitization-of-dbquerytext).
|
||||
Parameterized query text SHOULD be collected by default (the query parameter values themselves are opt-in, see [`db.query.parameter.<key>`](/docs/attributes-registry/db.md)).
|
||||
|
||||
**[15] `db.stored_procedure.name`:** It is RECOMMENDED to capture the value as provided by the application
|
||||
**[14] `db.stored_procedure.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
|
||||
stored procedure name then that stored procedure name SHOULD be used.
|
||||
|
||||
**[16] `db.stored_procedure.name`:** If operation represents a stored procedure execution.
|
||||
**[15] `db.stored_procedure.name`:** If operation represents a stored procedure execution.
|
||||
|
||||
**[17] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
|
||||
**[16] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available.
|
||||
|
||||
**[18] `user_agent.original`:** The user-agent value is generated by SDK which is a combination of<br> `sdk_version` : Current version of SDK. e.g. 'cosmos-netstandard-sdk/3.23.0'<br> `direct_pkg_version` : Direct package version used by Cosmos DB SDK. e.g. '3.23.1'<br> `number_of_client_instances` : Number of cosmos client instances created by the application. e.g. '1'<br> `type_of_machine_architecture` : Machine architecture. e.g. 'X64'<br> `operating_system` : Operating System. e.g. 'Linux 5.4.0-1098-azure 104 18'<br> `runtime_framework` : Runtime Framework. e.g. '.NET Core 3.1.32'<br> `failover_information` : Generated key to determine if region failover enabled.
|
||||
**[17] `user_agent.original`:** The user-agent value is generated by SDK which is a combination of<br> `sdk_version` : Current version of SDK. e.g. 'cosmos-netstandard-sdk/3.23.0'<br> `direct_pkg_version` : Direct package version used by Cosmos DB SDK. e.g. '3.23.1'<br> `number_of_client_instances` : Number of cosmos client instances created by the application. e.g. '1'<br> `type_of_machine_architecture` : Machine architecture. e.g. 'X64'<br> `operating_system` : Operating System. e.g. 'Linux 5.4.0-1098-azure 104 18'<br> `runtime_framework` : Runtime Framework. e.g. '.NET Core 3.1.32'<br> `failover_information` : Generated key to determine if region failover enabled.
|
||||
Format Reg-{D (Disabled discovery)}-S(application region)|L(List of preferred regions)|N(None, user did not configure it).
|
||||
Default value is "NS".
|
||||
|
||||
**[19] `db.query.parameter`:** If a query parameter has no name and instead is referenced only by index,
|
||||
**[18] `db.query.parameter`:** If a query parameter has no name and instead is referenced only by index,
|
||||
then `<key>` SHOULD be the 0-based index.
|
||||
|
||||
`db.query.parameter.<key>` SHOULD match
|
||||
|
|
@ -369,20 +367,18 @@ Explaining bucket configuration:
|
|||
|
||||
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
||||
|---|---|---|---|---|---|
|
||||
| [`db.operation.name`](/docs/attributes-registry/db.md) | string | The name of the operation or command being executed. [1] | `findAndModify`; `HMSET`; `SELECT` | `Required` |  |
|
||||
| [`azure.cosmosdb.consistency.level`](/docs/attributes-registry/azure.md) | string | Account or request [consistency level](https://learn.microsoft.com/azure/cosmos-db/consistency-levels). | `Eventual`; `ConsistentPrefix`; `BoundedStaleness`; `Strong`; `Session` | `Conditionally Required` If available. |  |
|
||||
| [`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.collection.name`](/docs/attributes-registry/db.md) | string | Cosmos DB container name. [2] | `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` 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.
|
||||
|
||||
**[2] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application
|
||||
**[1] `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`,
|
||||
|
|
@ -397,6 +393,8 @@ 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.
|
||||
|
||||
**[2] `db.collection.name`:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
|
||||
|
||||
**[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.
|
||||
|
||||
|
|
|
|||
|
|
@ -83,9 +83,16 @@ For example, for an operation describing SQL query on an anonymous table like `S
|
|||
|
||||
This span describes database client call.
|
||||
|
||||
It SHOULD cover the duration of the corresponding call as if it was observed by the caller (such as client application).
|
||||
For example, if a transient issue happened and was retried within this database call, the corresponding span should cover the duration of the logical operation
|
||||
with all retries.
|
||||
Instrumentations SHOULD, when possible, record database spans that cover the duration of
|
||||
the corresponding API call as if it was observed by the caller (such as client application).
|
||||
For example, if a transient issue happened and was retried within this database call, the corresponding
|
||||
span should cover the duration of the logical operation with all retries.
|
||||
|
||||
When a database client provides higher-level convenience APIs for specific operations
|
||||
(e.g., calling a stored procedure), which internally generate and execute a generic query,
|
||||
it is RECOMMENDED to instrument the higher-level convenience APIs.
|
||||
These often allow setting `db.operation.*` attributes, which usually are not
|
||||
readily available at the generic query level.
|
||||
|
||||
**Span name** is covered in the [Name](/docs/database/database-spans.md#name) section.
|
||||
|
||||
|
|
|
|||
|
|
@ -38,28 +38,28 @@ Spans representing calls to an HBase database adhere to the general [Semantic Co
|
|||
|
||||
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
||||
|---|---|---|---|---|---|
|
||||
| [`db.collection.name`](/docs/attributes-registry/db.md) | string | The HBase table name. [1] | `mytable`; `ns:table` | `Conditionally Required` If applicable. |  |
|
||||
| [`db.namespace`](/docs/attributes-registry/db.md) | string | The HBase namespace. [2] | `mynamespace` | `Conditionally Required` If applicable. |  |
|
||||
| [`db.operation.name`](/docs/attributes-registry/db.md) | string | The name of the operation or command being executed. [3] | `findAndModify`; `HMSET`; `SELECT` | `Conditionally Required` If readily available. |  |
|
||||
| [`db.operation.name`](/docs/attributes-registry/db.md) | string | The name of the operation or command being executed. [1] | `findAndModify`; `HMSET`; `SELECT` | `Required` |  |
|
||||
| [`db.collection.name`](/docs/attributes-registry/db.md) | string | The HBase table name. [2] | `mytable`; `ns:table` | `Conditionally Required` If applicable. |  |
|
||||
| [`db.namespace`](/docs/attributes-registry/db.md) | string | The HBase namespace. [3] | `mynamespace` | `Conditionally Required` If applicable. |  |
|
||||
| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | Protocol-specific response code recorded as a string. [4] | `200`; `409`; `14` | `Conditionally Required` If response was received. |  |
|
||||
| [`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` |  |
|
||||
|
||||
**[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 from the most general to the most specific namespace component, using `|` as a separator between the components. Any missing components (and their associated separators) SHOULD be omitted.
|
||||
Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system.
|
||||
It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
|
||||
|
||||
**[3] `db.operation.name`:** It is RECOMMENDED to capture the value as provided by the application
|
||||
**[1] `db.operation.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 operation name
|
||||
then that operation name SHOULD be used prepended by `BATCH `,
|
||||
otherwise `db.operation.name` SHOULD be `BATCH`.
|
||||
|
||||
**[2] `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.
|
||||
|
||||
**[3] `db.namespace`:** If a database system has multiple namespace components, they SHOULD be concatenated from the most general to the most specific namespace component, using `|` as a separator between the components. Any missing components (and their associated separators) SHOULD be omitted.
|
||||
Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system.
|
||||
It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
|
||||
|
||||
**[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.
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ Spans representing calls to MongoDB adhere to the general [Semantic Conventions
|
|||
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
||||
|---|---|---|---|---|---|
|
||||
| [`db.collection.name`](/docs/attributes-registry/db.md) | string | The MongoDB collection being accessed within the database stated in `db.namespace`. [1] | `public.users`; `customers` | `Required` |  |
|
||||
| [`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` | `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 [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] |  |
|
||||
|
|
|
|||
|
|
@ -32,19 +32,22 @@ 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 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] |  |
|
||||
| [`db.operation.batch.size`](/docs/attributes-registry/db.md) | int | The number of queries included in a batch operation. [9] | `2`; `3`; `4` | `Recommended` |  |
|
||||
| [`db.query.text`](/docs/attributes-registry/db.md) | string | The full syntax of the Redis CLI command. [10] | `HMSET myhash field1 ? field2 ?` | `Recommended` |  |
|
||||
| [`db.stored_procedure.name`](/docs/attributes-registry/db.md) | string | The name or sha1 digest of a Lua script in the database. [11] | `GetCustomer` | `Recommended` If operation represents Lua script execution. |  |
|
||||
| [`network.peer.address`](/docs/attributes-registry/network.md) | string | Peer address of the database node where the operation was performed. [12] | `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
|
||||
| [`db.operation.name`](/docs/attributes-registry/db.md) | string | The Redis command name. [1] | `HMSET`; `GET`; `SET` | `Required` |  |
|
||||
| [`db.namespace`](/docs/attributes-registry/db.md) | string | The [database index] associated with the connection, represented as a string. [2] | `0`; `1`; `15` | `Conditionally Required` If and only if it can be captured reliably. |  |
|
||||
| [`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. [3] | `ERR`; `WRONGTYPE`; `CLUSTERDOWN` | `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` |  |
|
||||
| [`db.query.text`](/docs/attributes-registry/db.md) | string | The full syntax of the Redis CLI command. [9] | `HMSET myhash field1 ? field2 ?` | `Recommended` |  |
|
||||
| [`db.stored_procedure.name`](/docs/attributes-registry/db.md) | string | The name or sha1 digest of a Lua script in the database. [10] | `GetCustomer` | `Recommended` If operation represents Lua script execution. |  |
|
||||
| [`network.peer.address`](/docs/attributes-registry/network.md) | string | Peer address of the database node where the operation was performed. [11] | `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
|
||||
| [`network.peer.port`](/docs/attributes-registry/network.md) | int | Peer port number of the network connection. | `65123` | `Recommended` if and only if `network.peer.address` is set. |  |
|
||||
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [13] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
|
||||
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [12] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  |
|
||||
|
||||
**[1] `db.namespace`:** A connection's currently associated database index may change during its lifetime, e.g. from executing `SELECT <index>`.
|
||||
**[1] `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`.
|
||||
|
||||
**[2] `db.namespace`:** A connection's currently associated database index may change during its lifetime, e.g. from executing `SELECT <index>`.
|
||||
|
||||
If instrumentation is unable to capture the connection's currently associated database index on each query
|
||||
without triggering an additional query to be executed,
|
||||
|
|
@ -52,34 +55,29 @@ 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.
|
||||
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`.
|
||||
**[3] `db.response.status_code`:** All Redis error prefixes SHOULD be considered errors.
|
||||
|
||||
**[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`:** If the operation failed and status code is available.
|
||||
|
||||
**[4] `db.response.status_code`:** All Redis error prefixes SHOULD be considered errors.
|
||||
|
||||
**[5] `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] `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`.
|
||||
**[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`.
|
||||
|
||||
**[10] `db.query.text`:** Query text SHOULD NOT be collected by default unless there is sanitization that excludes sensitive data, e.g. by redacting all literal values present in the query text.
|
||||
**[9] `db.query.text`:** Query text SHOULD NOT be collected by default unless there is sanitization that excludes sensitive data, e.g. by redacting all literal values present in the query text.
|
||||
See [Sanitization of `db.query.text`](/docs/database/database-spans.md#sanitization-of-dbquerytext).
|
||||
The value provided for `db.query.text` SHOULD correspond to the syntax of the Redis CLI. If, for example, the [`HMSET` command](https://redis.io/docs/latest/commands/hmset) is invoked, `"HMSET myhash field1 ? field2 ?"` would be a suitable value for `db.query.text`.
|
||||
|
||||
**[11] `db.stored_procedure.name`:** See [FCALL](https://redis.io/docs/latest/commands/fcall/) and [EVALSHA](https://redis.io/docs/latest/commands/evalsha/).
|
||||
**[10] `db.stored_procedure.name`:** See [FCALL](https://redis.io/docs/latest/commands/fcall/) and [EVALSHA](https://redis.io/docs/latest/commands/evalsha/).
|
||||
|
||||
**[12] `network.peer.address`:** If a database operation involved multiple network calls (for example retries), the address of the last contacted node SHOULD be used.
|
||||
**[11] `network.peer.address`:** If a database operation involved multiple network calls (for example retries), the address of the last contacted node SHOULD be used.
|
||||
|
||||
**[13] `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.
|
||||
**[12] `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):
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ groups:
|
|||
# requirement_level:
|
||||
# conditionally_required: if available
|
||||
- ref: db.operation.name
|
||||
requirement_level:
|
||||
conditionally_required: If readily available.
|
||||
requirement_level: required
|
||||
- ref: db.collection.name
|
||||
brief: Cosmos DB container name.
|
||||
requirement_level:
|
||||
|
|
|
|||
|
|
@ -108,9 +108,16 @@ groups:
|
|||
stability: release_candidate
|
||||
brief: This span describes database client call.
|
||||
note: |
|
||||
It SHOULD cover the duration of the corresponding call as if it was observed by the caller (such as client application).
|
||||
For example, if a transient issue happened and was retried within this database call, the corresponding span should cover the duration of the logical operation
|
||||
with all retries.
|
||||
Instrumentations SHOULD, when possible, record database spans that cover the duration of
|
||||
the corresponding API call as if it was observed by the caller (such as client application).
|
||||
For example, if a transient issue happened and was retried within this database call, the corresponding
|
||||
span should cover the duration of the logical operation with all retries.
|
||||
|
||||
When a database client provides higher-level convenience APIs for specific operations
|
||||
(e.g., calling a stored procedure), which internally generate and execute a generic query,
|
||||
it is RECOMMENDED to instrument the higher-level convenience APIs.
|
||||
These often allow setting `db.operation.*` attributes, which usually are not
|
||||
readily available at the generic query level.
|
||||
|
||||
**Span name** is covered in the [Name](/docs/database/database-spans.md#name) section.
|
||||
|
||||
|
|
@ -361,8 +368,7 @@ groups:
|
|||
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.
|
||||
requirement_level: required
|
||||
- ref: db.response.status_code
|
||||
brief: >
|
||||
Protocol-specific response code recorded as a string.
|
||||
|
|
@ -449,6 +455,7 @@ groups:
|
|||
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`.
|
||||
requirement_level: required
|
||||
sampling_relevant: true
|
||||
- ref: db.query.text
|
||||
sampling_relevant: true
|
||||
|
|
@ -511,8 +518,7 @@ groups:
|
|||
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.
|
||||
requirement_level: required
|
||||
- ref: db.collection.name
|
||||
sampling_relevant: true
|
||||
brief:
|
||||
|
|
@ -796,6 +802,7 @@ groups:
|
|||
operations performed by Cosmos DB client.
|
||||
examples: ["Microsoft.DocumentDB"]
|
||||
- ref: db.operation.name
|
||||
requirement_level: required
|
||||
note: |
|
||||
The `db.operation.name` has the following list of well-known values.
|
||||
If one of them applies, then the respective value MUST be used.
|
||||
|
|
@ -920,7 +927,6 @@ groups:
|
|||
If none of them applies, it's RECOMMENDED to use language-agnostic representation of
|
||||
client method name in snake_case. Instrumentations SHOULD document
|
||||
additional values when introducing new operations.
|
||||
|
||||
examples: ['create_item', 'query_items', 'read_item']
|
||||
- ref: db.stored_procedure.name
|
||||
requirement_level:
|
||||
|
|
|
|||
Loading…
Reference in New Issue