Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cosmos DB: Add support for Span #23268

Merged
merged 30 commits into from
Aug 12, 2024
Merged

Cosmos DB: Add support for Span #23268

merged 30 commits into from
Aug 12, 2024

Conversation

ealsur
Copy link
Member

@ealsur ealsur commented Aug 1, 2024

This PR modifies Client to have the internal azcore.Client embedded to leverage the Pipeline and Trace.

All the methods (except Pagers because they internally already do it) that execute an async operation will now start a Span respectively.

Added a helper SpanValidator to be used in tests to validate that the expected Spans are generated.

Properties

Reference: https://github.com/open-telemetry/semantic-conventions/blob/v1.27.0/docs/database/cosmosdb.md

  • The code defines the TracingOptions to set az.namespace to Microsoft.DocumentDB
  • db.system = cosmosdb
  • db.cosmosdb.connection_mode = gateway
  • db.namespace (when applicable) = datbase id
  • db.collection.name (when applicable) = container id
  • db.operation.name = span name (for example create_container)
  • server.address and server.port = based on the endpoint (for example myaccount.documents.azure.com, server.port is added only if it's different than 443)

Span names

Covers the list in

otelSpanNameCreateDatabase = "create_database"
otelSpanNameReadDatabase = "read_database"
otelSpanNameDeleteDatabase = "delete_database"
otelSpanNameQueryDatabases = "query_databases"
otelSpanNameReadThroughputDatabase = "read_database_throughput"
otelSpanNameReplaceThroughputDatabase = "replace_database_throughput"
otelSpanNameCreateContainer = "create_container"
otelSpanNameReadContainer = "read_container"
otelSpanNameDeleteContainer = "delete_container"
otelSpanNameReplaceContainer = "replace_container"
otelSpanNameQueryContainers = "query_containers"
otelSpanNameReadThroughputContainer = "read_container_throughput"
otelSpanNameReaplaceThroughputContainer = "replace_container_throughput"
otelSpanNameExecuteBatch = "execute_batch"
otelSpanNameCreateItem = "create_item"
otelSpanNameReadItem = "read_item"
otelSpanNameDeleteItem = "delete_item"
otelSpanNameReplaceItem = "replace_item"
otelSpanNameUpsertItem = "upsert_item"
otelSpanNamePatchItem = "patch_item"
otelSpanNameQueryItems = "query_items"

Closes #23185

@ealsur ealsur enabled auto-merge (squash) August 2, 2024 14:14
sdk/data/azcosmos/CHANGELOG.md Outdated Show resolved Hide resolved
sdk/data/azcosmos/cosmos_container.go Outdated Show resolved Hide resolved
@kushagraThapar kushagraThapar disabled auto-merge August 2, 2024 15:47
@ealsur ealsur merged commit b31a752 into Azure:main Aug 12, 2024
13 checks passed
@ealsur ealsur deleted the users/ealsur/tracer branch August 12, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tracing to the Cosmos Client
5 participants