From 3c16c802e8ae8849ae0cf31eac02c3cabf64e4dd Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Fri, 23 Aug 2024 12:43:43 -0700 Subject: [PATCH] CosmosDB: define applicable values for `db.operation.name` and add proper reference to `az.namespace` (#1330) --- .chloggen/1330.yaml | 4 + docs/attributes-registry/azure.md | 7 +- docs/attributes-registry/db.md | 36 ++-- docs/database/cosmosdb.md | 212 ++++++++++++++++++------ docs/database/database-spans.md | 2 +- model/registry/azure.yaml | 7 + model/registry/db.yaml | 58 +++---- model/trace/database.yaml | 139 +++++++++++++++- templates/registry/markdown/weaver.yaml | 1 - 9 files changed, 365 insertions(+), 101 deletions(-) create mode 100644 .chloggen/1330.yaml diff --git a/.chloggen/1330.yaml b/.chloggen/1330.yaml new file mode 100644 index 0000000000..ec0d7fb8ee --- /dev/null +++ b/.chloggen/1330.yaml @@ -0,0 +1,4 @@ +change_type: enhancement +component: az, db +note: Define `db.operation.name` values for Cosmos DB, declare `az.namespace` attribute and add proper reference to it. +issues: [1330] diff --git a/docs/attributes-registry/azure.md b/docs/attributes-registry/azure.md index 95dbf95a15..4f4a1f385e 100644 --- a/docs/attributes-registry/azure.md +++ b/docs/attributes-registry/azure.md @@ -10,6 +10,7 @@ This document defines generic attributes for Azure SDK. -| Attribute | Type | Description | Examples | Stability | -| ----------------------- | ------ | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ---------------------------------------------------------------- | -| `az.service_request_id` | string | The unique identifier of the service request. It's generated by the Azure service and returned with the response. | `00000000-0000-0000-0000-000000000000` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| Attribute | Type | Description | Examples | Stability | +| ----------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ---------------------------------------------------------------- | +| `az.namespace` | string | [Azure Resource Provider Namespace](https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers) as recognized by the client. | `Microsoft.Storage`; `Microsoft.KeyVault`; `Microsoft.ServiceBus` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `az.service_request_id` | string | The unique identifier of the service request. It's generated by the Azure service and returned with the response. | `00000000-0000-0000-0000-000000000000` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | diff --git a/docs/attributes-registry/db.md b/docs/attributes-registry/db.md index e36db87d95..7f2237aea5 100644 --- a/docs/attributes-registry/db.md +++ b/docs/attributes-registry/db.md @@ -155,7 +155,7 @@ This group defines attributes for Azure Cosmos DB. | ------------------------------------ | ------ | --------------------------------- | -------------------------------------- | ---------------------------------------------------------------- | | `db.cosmosdb.client_id` | string | Unique Cosmos client instance id. | `3ba4827d-4422-483f-b59f-85b74211c11d` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `db.cosmosdb.connection_mode` | string | Cosmos client connection mode. | `gateway`; `direct` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `db.cosmosdb.operation_type` | string | CosmosDB Operation Type. | `Invalid`; `Create`; `Patch` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `db.cosmosdb.operation_type` | string | Cosmos DB Operation Type. | `batch`; `create`; `delete` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `db.cosmosdb.request_charge` | double | RU consumed for that operation | `46.18`; `1.0` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `db.cosmosdb.request_content_length` | int | Request payload size in bytes | | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `db.cosmosdb.status_code` | int | Cosmos DB status code. | `200`; `201` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | @@ -170,23 +170,23 @@ This group defines attributes for Azure Cosmos DB. `db.cosmosdb.operation_type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used. -| Value | Description | Stability | -| ------------------- | ------------------ | ---------------------------------------------------------------- | -| `Batch` | batch | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Create` | create | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Delete` | delete | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Execute` | execute | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `ExecuteJavaScript` | execute_javascript | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Head` | head | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `HeadFeed` | head_feed | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Invalid` | invalid | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Patch` | patch | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Query` | query | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `QueryPlan` | query_plan | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Read` | read | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `ReadFeed` | read_feed | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Replace` | replace | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Upsert` | upsert | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| Value | Description | Stability | +| -------------------- | ------------------ | ---------------------------------------------------------------- | +| `batch` | batch | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `create` | create | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `delete` | delete | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `execute` | execute | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `execute_javascript` | execute_javascript | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `head` | head | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `head_feed` | head_feed | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `invalid` | invalid | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `patch` | patch | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `query` | query | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `query_plan` | query_plan | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `read` | read | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `read_feed` | read_feed | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `replace` | replace | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `upsert` | upsert | ![Experimental](https://img.shields.io/badge/-experimental-blue) | ## Elasticsearch Attributes diff --git a/docs/database/cosmosdb.md b/docs/database/cosmosdb.md index 5b597c30ef..1200fc7ee8 100644 --- a/docs/database/cosmosdb.md +++ b/docs/database/cosmosdb.md @@ -25,51 +25,172 @@ Cosmos DB instrumentation includes call-level (public API) surface spans and net | Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | |---|---|---|---|---|---| | [`db.collection.name`](/docs/attributes-registry/db.md) | string | Cosmos DB container name. [1] | `public.users`; `customers` | `Conditionally Required` if available | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| [`db.cosmosdb.connection_mode`](/docs/attributes-registry/db.md) | string | Cosmos client connection mode. | `gateway`; `direct` | `Conditionally Required` if not `direct` (or pick gw as default) | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| [`db.cosmosdb.operation_type`](/docs/attributes-registry/db.md) | string | CosmosDB Operation Type. | `Invalid`; `Create`; `Patch` | `Conditionally Required` when performing one of the operations in this list | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`db.cosmosdb.connection_mode`](/docs/attributes-registry/db.md) | string | Cosmos client connection mode. | `gateway`; `direct` | `Conditionally Required` [2] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`db.cosmosdb.operation_type`](/docs/attributes-registry/db.md) | string | Cosmos DB Operation Type. | `batch`; `create`; `delete` | `Conditionally Required` when performing one of the operations in this list | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`db.cosmosdb.request_charge`](/docs/attributes-registry/db.md) | double | RU consumed for that operation | `46.18`; `1.0` | `Conditionally Required` when available | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`db.cosmosdb.status_code`](/docs/attributes-registry/db.md) | int | Cosmos DB status code. | `200`; `201` | `Conditionally Required` if response was received | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`db.cosmosdb.sub_status_code`](/docs/attributes-registry/db.md) | int | Cosmos DB sub status code. | `1000`; `1002` | `Conditionally Required` when response was received and contained sub-code. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`db.namespace`](/docs/attributes-registry/db.md) | string | The name of the database, fully qualified within the server address and port. | `customers`; `test.users` | `Conditionally Required` If available. | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| [`db.operation.name`](/docs/attributes-registry/db.md) | string | The name of the operation or command being executed. [2] | `findAndModify`; `HMSET`; `SELECT` | `Conditionally Required` [3] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| [`error.type`](/docs/attributes-registry/error.md) | string | Describes a class of error the operation ended with. [4] | `timeout`; `java.net.UnknownHostException`; `server_certificate_invalid`; `500` | `Conditionally Required` If and only if the operation failed. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | -| [`server.port`](/docs/attributes-registry/server.md) | int | Server port number. [5] | `80`; `8080`; `443` | `Conditionally Required` [6] | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | +| [`db.operation.name`](/docs/attributes-registry/db.md) | string | The name of the operation or command being executed. [3] | `create_item`; `query_items`; `read_item` | `Conditionally Required` [4] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`error.type`](/docs/attributes-registry/error.md) | string | Describes a class of error the operation ended with. [5] | `timeout`; `java.net.UnknownHostException`; `server_certificate_invalid`; `500` | `Conditionally Required` If and only if the operation failed. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | +| [`server.port`](/docs/attributes-registry/server.md) | int | Server port number. [6] | `80`; `8080`; `443` | `Conditionally Required` If not default (443). | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | +| [`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. [7] | `Microsoft.DocumentDB` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`db.cosmosdb.client_id`](/docs/attributes-registry/db.md) | string | Unique Cosmos client instance id. | `3ba4827d-4422-483f-b59f-85b74211c11d` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`db.cosmosdb.request_content_length`](/docs/attributes-registry/db.md) | int | Request payload size in bytes | | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| [`db.query.text`](/docs/attributes-registry/db.md) | string | The database query being executed. [7] | `SELECT * FROM wuser_table where username = ?`; `SET mykey "WuValue"` | `Recommended` [8] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [9] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | -| [`user_agent.original`](/docs/attributes-registry/user-agent.md) | string | Full user-agent string is generated by Cosmos DB SDK [10] | `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` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | -| [`db.query.parameter.`](/docs/attributes-registry/db.md) | string | A query parameter used in `db.query.text`, with `` being the parameter name, and the attribute value being a string representation of the parameter value. [11] | `someval`; `55` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`db.query.text`](/docs/attributes-registry/db.md) | string | The database query being executed. [8] | `SELECT * FROM wuser_table where username = ?`; `SET mykey "WuValue"` | `Recommended` [9] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [10] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | +| [`user_agent.original`](/docs/attributes-registry/user-agent.md) | string | Full user-agent string is generated by Cosmos DB SDK [11] | `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` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | +| [`db.query.parameter.`](/docs/attributes-registry/db.md) | string | A query parameter used in `db.query.text`, with `` being the parameter name, and the attribute value being a string representation of the parameter value. [12] | `someval`; `55` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization. -If the collection name is parsed from the query text, it SHOULD be the first collection name found in the query and it SHOULD match the value provided in the query text including any schema and database name prefix. -For batch operations, if the individual operations are known to have the same collection name then that collection name SHOULD be used, otherwise `db.collection.name` SHOULD NOT be captured. -**[2]:** It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization. -If the operation name is parsed from the query text, it SHOULD be the first operation name found in the query. -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. +**[2]:** if not `gateway` (the default value is assumed to be `gateway`). + +**[3]:** 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: + +- `execute_batch` + +Bulk operations: + +- `execute_bulk` SHOULD be used on spans reported for methods like + [`executeBulkOperations`](https://javadoc.io/doc/com.azure/azure-cosmos/latest/com/azure/cosmos/CosmosAsyncContainer.html#executeBulkOperations)). + which represents a bulk execution of multiple operations. +- `bulk_{operation name}` (`bulk_create_item`, `bulk_upsert_item`, etc) SHOULD be used on spans describing individual operations (when they are reported) + within the bulk. This pattern SHOULD be used when instrumentation creates span per each operation, but operations are buffered and then performed in bulk. + For example, this applies when [`AllowBulkExecution`](https://learn.microsoft.com/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions.allowbulkexecution) + property is configured on the `Microsoft.Azure.Cosmos` client. + +Change feed operations: + +- `query_change_feed` + +Conflicts operations: + +- `delete_conflict` +- `query_conflicts` +- `read_all_conflicts` +- `read_conflict` -**[3]:** If readily available. The operation name MAY be parsed from the query text, in which case it SHOULD be the first operation name found in the query. +Container operations: -**[4]:** The `error.type` SHOULD match the error code returned by the database or the client library, the canonical name of exception that occurred, or another low-cardinality error identifier. Instrumentations SHOULD document the list of errors they report. +- `create_container` +- `create_container_if_not_exists` +- `delete_container` +- `query_containers` +- `read_all_containers` +- `read_container` +- `read_container_throughput` +- `replace_container` +- `replace_container_throughput` -**[5]:** When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available. +Database operations: -**[6]:** If using a port other than the default port for this DBMS and if `server.address` is set. +- `create_database` +- `create_database_if_not_exists` +- `delete_database` +- `query_databases` +- `read_all_databases` +- `read_database` +- `read_database_throughput` +- `replace_database_throughput` -**[7]:** For sanitization see [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext). +Encryption key operations: + +- `create_client_encryption_key` +- `query_client_encryption_keys` +- `read_all_client_encryption_keys` +- `read_client_encryption_key` +- `replace_client_encryption_key` + +Item operations: + +- `create_item` +- `delete_all_items_by_partition_key` +- `delete_item` +- `patch_item` +- `query_items` +- `read_all_items` +- `read_all_items_of_logical_partition` +- `read_many_items` +- `read_item` +- `replace_item` +- `upsert_item` + +Permission operations: + +- `create_permission` +- `delete_permission` +- `query_permissions` +- `read_all_permissions` +- `read_permission` +- `replace_permission` +- `upsert_permission` + +Stored procedure operations: + +- `create_stored_procedure` +- `delete_stored_procedure` +- `execute_stored_procedure` +- `query_stored_procedures` +- `read_all_stored_procedures` +- `read_stored_procedure` +- `replace_stored_procedure` + +Trigger operations: + +- `create_trigger` +- `delete_trigger` +- `query_triggers` +- `read_all_triggers` +- `read_trigger` +- `replace_trigger` + +User operations: + +- `create_user` +- `delete_user` +- `query_users` +- `read_all_users` +- `read_user` +- `replace_user` +- `upsert_user` + +User-defined function operations: + +- `create_user_defined_function` +- `delete_user_defined_function` +- `query_user_defined_functions` +- `read_all_user_defined_functions` +- `read_user_defined_function` + +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. + +**[4]:** If readily available. The operation name MAY be parsed from the query text, in which case it SHOULD be the first operation name found in the query. + +**[5]:** The `error.type` SHOULD match the error code returned by the database or the client library, the canonical name of exception that occurred, or another low-cardinality error identifier. Instrumentations SHOULD document the list of errors they report. + +**[6]:** 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]:** When `az.namespace` attribute is populated, it MUST be set to `Microsoft.DocumentDB` for all operations performed by Cosmos DB client. + +**[8]:** 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. 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. -**[8]:** SHOULD be collected by default only if there is sanitization that excludes sensitive information. See [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext). +**[9]:** SHOULD be collected by default only if there is sanitization that excludes sensitive information. See [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext). -**[9]:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available. +**[10]:** 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. -**[10]:** The user-agent value is generated by SDK which is a combination of
`sdk_version` : Current version of SDK. e.g. 'cosmos-netstandard-sdk/3.23.0'
`direct_pkg_version` : Direct package version used by Cosmos DB SDK. e.g. '3.23.1'
`number_of_client_instances` : Number of cosmos client instances created by the application. e.g. '1'
`type_of_machine_architecture` : Machine architecture. e.g. 'X64'
`operating_system` : Operating System. e.g. 'Linux 5.4.0-1098-azure 104 18'
`runtime_framework` : Runtime Framework. e.g. '.NET Core 3.1.32'
`failover_information` : Generated key to determine if region failover enabled. +**[11]:** The user-agent value is generated by SDK which is a combination of
`sdk_version` : Current version of SDK. e.g. 'cosmos-netstandard-sdk/3.23.0'
`direct_pkg_version` : Direct package version used by Cosmos DB SDK. e.g. '3.23.1'
`number_of_client_instances` : Number of cosmos client instances created by the application. e.g. '1'
`type_of_machine_architecture` : Machine architecture. e.g. 'X64'
`operating_system` : Operating System. e.g. 'Linux 5.4.0-1098-azure 104 18'
`runtime_framework` : Runtime Framework. e.g. '.NET Core 3.1.32'
`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". -**[11]:** Query parameters should only be captured when `db.query.text` is parameterized with placeholders. +**[12]:** Query parameters should only be captured when `db.query.text` is parameterized with placeholders. If a parameter has no name and instead is referenced only by index, then `` SHOULD be the 0-based index. @@ -96,21 +217,21 @@ and SHOULD be provided **at span creation time** (if provided at all): | Value | Description | Stability | |---|---|---| -| `Batch` | batch | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Create` | create | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Delete` | delete | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Execute` | execute | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `ExecuteJavaScript` | execute_javascript | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Head` | head | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `HeadFeed` | head_feed | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Invalid` | invalid | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Patch` | patch | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Query` | query | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `QueryPlan` | query_plan | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Read` | read | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `ReadFeed` | read_feed | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Replace` | replace | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `Upsert` | upsert | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `batch` | batch | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `create` | create | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `delete` | delete | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `execute` | execute | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `execute_javascript` | execute_javascript | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `head` | head | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `head_feed` | head_feed | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `invalid` | invalid | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `patch` | patch | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `query` | query | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `query_plan` | query_plan | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `read` | read | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `read_feed` | read_feed | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `replace` | replace | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `upsert` | upsert | ![Experimental](https://img.shields.io/badge/-experimental-blue) | `error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used. @@ -126,25 +247,20 @@ and SHOULD be provided **at span creation time** (if provided at all): -In addition to Cosmos DB attributes, all spans include -`az.namespace` attribute representing Azure Resource Provider namespace that MUST be equal to `Microsoft.DocumentDB`. - ## Example | Key | Value | |:-------------------------------------| :------------------- | -| Span name | `"ReadItemsAsync orders"` | -| `kind` | `"internal"` | +| Span name | `"read_item orders"` | | `az.namespace` | `"Microsoft.DocumentDB"` | | `db.system` | `"cosmosdb"` | | `db.collection.name` | `"orders"` | | `db.namespace` | `"ShopDb"` | -| `db.operation.name` | `"ReadItemsAsync"` | +| `db.operation.name` | `"read_item"` | | `server.address` | `"account.documents.azure.com"` | -| `db.cosmosdb.client_id` | `3ba4827d-4422-483f-b59f-85b74211c11d` | -| `db.cosmosdb.operation_type` | `Read` | -| `user_agent.original` | `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\|` | -| `db.cosmosdb.connection_mode` | `"Direct"` | +| `db.cosmosdb.client_id` | `"3ba4827d-4422-483f-b59f-85b74211c11d"` | +| `db.cosmosdb.operation_type` | `"read"` | +| `user_agent.original` | `"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\|"` | | `db.cosmosdb.request_content_length` | `20` | | `db.cosmosdb.status_code` | `201` | | `db.cosmosdb.sub_status_code` | `0` | diff --git a/docs/database/database-spans.md b/docs/database/database-spans.md index 66e1b3c297..ab5a1b334b 100644 --- a/docs/database/database-spans.md +++ b/docs/database/database-spans.md @@ -70,7 +70,7 @@ Semantic conventions for individual database systems MAY specify different span The `{target}` SHOULD describe the entity that the operation is performed against and SHOULD adhere to one of the following values, provided they are accessible: -- `db.collection.name` SHOULD be used for data manipulation operations or operations on database collections. +- `db.collection.name` SHOULD be used for data manipulation operations or operations on a database collection. - `db.namespace` SHOULD be used for operations on a specific database namespace. - `server.address:server.port` SHOULD be used for other operations not targeting any specific database(s) or collection(s) diff --git a/model/registry/azure.yaml b/model/registry/azure.yaml index 3e7c603dda..2fdd5c9501 100644 --- a/model/registry/azure.yaml +++ b/model/registry/azure.yaml @@ -10,3 +10,10 @@ groups: brief: "The unique identifier of the service request. It's generated by the Azure service and returned with the response." examples: - "00000000-0000-0000-0000-000000000000" + - id: az.namespace + type: string + stability: experimental + brief: > + [Azure Resource Provider Namespace](https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers) + as recognized by the client. + examples: ["Microsoft.Storage", "Microsoft.KeyVault", "Microsoft.ServiceBus"] diff --git a/model/registry/db.yaml b/model/registry/db.yaml index d2e406264a..081e140f20 100644 --- a/model/registry/db.yaml +++ b/model/registry/db.yaml @@ -443,53 +443,53 @@ groups: - id: db.cosmosdb.operation_type type: members: - - id: invalid - value: "Invalid" + - id: batch + value: "batch" stability: experimental - id: create - value: "Create" - stability: experimental - - id: patch - value: "Patch" - stability: experimental - - id: read - value: "Read" - stability: experimental - - id: read_feed - value: "ReadFeed" + value: "create" stability: experimental - id: delete - value: "Delete" - stability: experimental - - id: replace - value: "Replace" + value: "delete" stability: experimental - id: execute - value: "Execute" + value: "execute" stability: experimental - - id: query - value: "Query" + - id: execute_javascript + value: "execute_javascript" + stability: experimental + - id: invalid + value: "invalid" stability: experimental - id: head - value: "Head" + value: "head" stability: experimental - id: head_feed - value: "HeadFeed" + value: "head_feed" stability: experimental - - id: upsert - value: "Upsert" + - id: patch + value: "patch" stability: experimental - - id: batch - value: "Batch" + - id: query + value: "query" stability: experimental - id: query_plan - value: "QueryPlan" + value: "query_plan" stability: experimental - - id: execute_javascript - value: "ExecuteJavaScript" + - id: read + value: "read" + stability: experimental + - id: read_feed + value: "read_feed" + stability: experimental + - id: replace + value: "replace" + stability: experimental + - id: upsert + value: "upsert" stability: experimental stability: experimental - brief: CosmosDB Operation Type. + brief: Cosmos DB Operation Type. - id: db.cosmosdb.request_charge type: double stability: experimental diff --git a/model/trace/database.yaml b/model/trace/database.yaml index 09eb678c03..6e507c7fb6 100644 --- a/model/trace/database.yaml +++ b/model/trace/database.yaml @@ -358,10 +358,12 @@ groups: examples: ['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\|'] - ref: db.cosmosdb.connection_mode requirement_level: - conditionally_required: if not `direct` (or pick gw as default) + conditionally_required: if not `gateway` (the default value is assumed to be `gateway`). - 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. requirement_level: conditionally_required: if available - ref: db.cosmosdb.request_content_length @@ -379,3 +381,138 @@ groups: requirement_level: conditionally_required: If available. note: "" # overriding the base note + - ref: az.namespace + note: > + When `az.namespace` attribute is populated, it MUST be set to `Microsoft.DocumentDB` for all + operations performed by Cosmos DB client. + examples: ["Microsoft.DocumentDB"] + - ref: db.operation.name + 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. + + Batch operations: + + - `execute_batch` + + Bulk operations: + + - `execute_bulk` SHOULD be used on spans reported for methods like + [`executeBulkOperations`](https://javadoc.io/doc/com.azure/azure-cosmos/latest/com/azure/cosmos/CosmosAsyncContainer.html#executeBulkOperations)). + which represents a bulk execution of multiple operations. + - `bulk_{operation name}` (`bulk_create_item`, `bulk_upsert_item`, etc) SHOULD be used on spans describing individual operations (when they are reported) + within the bulk. This pattern SHOULD be used when instrumentation creates span per each operation, but operations are buffered and then performed in bulk. + For example, this applies when [`AllowBulkExecution`](https://learn.microsoft.com/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions.allowbulkexecution) + property is configured on the `Microsoft.Azure.Cosmos` client. + + Change feed operations: + + - `query_change_feed` + + Conflicts operations: + + - `delete_conflict` + - `query_conflicts` + - `read_all_conflicts` + - `read_conflict` + + Container operations: + + - `create_container` + - `create_container_if_not_exists` + - `delete_container` + - `query_containers` + - `read_all_containers` + - `read_container` + - `read_container_throughput` + - `replace_container` + - `replace_container_throughput` + + Database operations: + + - `create_database` + - `create_database_if_not_exists` + - `delete_database` + - `query_databases` + - `read_all_databases` + - `read_database` + - `read_database_throughput` + - `replace_database_throughput` + + Encryption key operations: + + - `create_client_encryption_key` + - `query_client_encryption_keys` + - `read_all_client_encryption_keys` + - `read_client_encryption_key` + - `replace_client_encryption_key` + + Item operations: + + - `create_item` + - `delete_all_items_by_partition_key` + - `delete_item` + - `patch_item` + - `query_items` + - `read_all_items` + - `read_all_items_of_logical_partition` + - `read_many_items` + - `read_item` + - `replace_item` + - `upsert_item` + + Permission operations: + + - `create_permission` + - `delete_permission` + - `query_permissions` + - `read_all_permissions` + - `read_permission` + - `replace_permission` + - `upsert_permission` + + Stored procedure operations: + + - `create_stored_procedure` + - `delete_stored_procedure` + - `execute_stored_procedure` + - `query_stored_procedures` + - `read_all_stored_procedures` + - `read_stored_procedure` + - `replace_stored_procedure` + + Trigger operations: + + - `create_trigger` + - `delete_trigger` + - `query_triggers` + - `read_all_triggers` + - `read_trigger` + - `replace_trigger` + + User operations: + + - `create_user` + - `delete_user` + - `query_users` + - `read_all_users` + - `read_user` + - `replace_user` + - `upsert_user` + + User-defined function operations: + + - `create_user_defined_function` + - `delete_user_defined_function` + - `query_user_defined_functions` + - `read_all_user_defined_functions` + - `read_user_defined_function` + + 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: server.port + requirement_level: + conditionally_required: If not default (443). diff --git a/templates/registry/markdown/weaver.yaml b/templates/registry/markdown/weaver.yaml index a3e7f60b25..0570d9f9f2 100644 --- a/templates/registry/markdown/weaver.yaml +++ b/templates/registry/markdown/weaver.yaml @@ -13,7 +13,6 @@ acronyms: - CloudEvents - CLR - CPU - - CosmosDB - DynamoDB - ECS - EKS