open-telemetry / semantic-conventions

Defines standards for generating consistent, accessible telemetry across a variety of domains
Apache License 2.0
261 stars 167 forks source link

Cosmos DB: Operation Level Metrics #1438

Open sourabh1007 opened 2 weeks ago

sourabh1007 commented 2 weeks ago

Introducing operation-level metrics in the .NET Cosmos DB SDK. This PR includes the registration of semantic conventions in the OpenTelemetry community, ensuring full alignment with OpenTelemetry's established guidelines.

Dimensions Tag/dimension name Sample value
db.system cosmodb
db.collection.name myCollectionName
db.namespace myDatabaseName
server.address myaccountname.documents.azure.com
server.port 443
db.operation.name query_items
db.cosmosdb.operation_type batch; create; delete
db.response.status_code 200 or 429 etc.
db.cosmos.sub_status_code 1002 etc.
db.cosmos.client_id Guid
db.cosmosdb.consistency_level Eventual, ConsistentPrefix, BoundedStaleness, Strong or Session
db.cosmosdb.machine_id Unique Id for a machine (Dependent of otel generated machine details)
Metrics Name Unit Type Description
db.cosmosdb.operation.request_charge {request_units} histogram Total request units per operation (sum of RUs for all requested needed when processing an operation) This metric SHOULD be specified with [ExplicitBucketBoundaries] of [ 1, 5, 10, 25, 50, 100, 250, 500, 1000]
db.client.operation.duration s histogram Total end-to-end duration of the operation This metric SHOULD be specified with [ExplicitBucketBoundaries] of [0.001, 0.005, 0.010, 0.050, 0.100, 0.200, 0.500, 1.000, 2.000, 5.000]
db.query.limit {count} histogram For feed operations (query, readAll, readMany, change feed) and batch operations, this meter capture the requested maxItemCount per page/request. This metric SHOULD be specified with [ExplicitBucketBoundaries] of [50, 100, 250, 500, 1000, 2000, 5000]
db.client.response.row_count {count} histogram For feed operations (query, readAll, readMany, change feed) batch operations this meter capture the actual item count in responses from the service. This metric SHOULD be specified with [ExplicitBucketBoundaries] of [10, 50, 100, 250, 500, 1000, 2000, 5000, 10000].
db.cosmosdb.operation.regions_contacted {count} histogram Number of regions contacted when executing an operation. This metric SHOULD be specified with [ExplicitBucketBoundaries] of [1, 2, 3, 5, 10, 20, 50].
db.cosmosdb.client.active_instances {count} updowncounter Number of active SDK client instances.

Added db.cosmosdb.consistency_level in attribute list also, we are going to collect it is traces also Removed db.cosmosdb.operation_type Added db.cosmosdb.machine_id in attribute list also, we are going to collect it is traces also

Merge requirement checklist