Support CosmosDb dependency tracking#2635
Conversation
|
/cc @sourabh1007 |
|
Why PR headline talk about Cosmos DB "Direct Mode"? is it connection mode specific changes? |
|
Events are loosing diagnostics message while listened by appinsight..below is the log I got Application Insights Telemetry: {"name":"AppTraces","time":"2022-09-23T17:42:26.1395222Z","iKey":"2fabff39-6a32-42da-9e8f-9fcff7d99c6b","tags":{"ai.application.ver":"1.0.0.0","ai.cloud.roleInstance":"DESKTOP-I8MO142","ai.operation.id":"2239023b88bb44b60eab840e1983cded","ai.operation.parentId":"80155111011166ad","ai.internal.sdkVersion":"dotnetc:2.22.0-14","ai.internal.nodeName":"DESKTOP-I8MO142"},"data":{"baseType":"MessageData","baseData":{"ver":2,"message":"n/a","severityLevel":"Warning","properties":{"EventName":"WriteWarningEvent","EventId":"2","AspNetCoreEnvironment":"Development","DeveloperMode":"true","CategoryName":"Azure.Cosmos"}}}} Cosmosdb SDK doesn't send n/a. |
56e0a58 to
130a894
Compare
Fixed, please check |
for this we need portal team to support Azure CosmosDB (in addition to DocumentDB) - there is nothing I can do on SDK side |
but previously this icon was coming. in this latest package only it is not showing up |

Cosmos DB SDK (Microsoft.Azure.Cosmos v3.TODO now supports dependency tracking, even when used in
Direct(TCP) mode.You should see
DependencyTelemetryreported for all public API calls (that involve network communication with the service). If you useGateway(HTTP) mode, you would also see dependencies for underlying HTTP calls. ForDirectcalls, you might see a few nested HTTP dependencies too, but low-level TCP calls are not traced.Attributes reported by Cosmos SDK can be found here: Azure/azure-cosmos-dotnet-v3#3058. They are populated as custom dimensions.
New dependencies tracing public API calls should have:
Targetfollowing{CosmosDB resource name} | {database name}pattern, e.g.cosmos-tracing-demo | my-store.Namefollows{container name} | {operation}pattern, e.g.orders | ReadTypematches Resource Provider namespace (Microsoft.DocumentDB)sdkversionmatchesrdddsaz.You can enable distributed tracing for Cosmos with the following API: TODO, add a link to cosmos docs.
In addition to dependency calls, Cosmos DB reports extensive diagnostics when an operation fails or takes too long. You can configure it with the following settings on the Cosmos DB client - TODO.
This diagnostics is sent as a log (
TraceTelemetry) withWarningseverity havingCosmosDiagnosticsas JSON in the message. You can identify it usingEventName(in custom dimensions) with theRecordDiagnosticsForRequestsvalue.Such
TraceTelemetryshould be a child of Cosmos DB dependency telemetry described above.Changes
CosmosDB direct (TCP mode) dependency tracking (coming in future versions of Cosmos DB v3 SDK).
Uses attributes outlined here and additional cosmos diagnostics is coming from the specific event source and is tracked as
TraceTelemetry.EventSource verbosity is expected to be low - it will be controlled by CosmosDb customers on CosmosDb side. Cosmos would write it when an operation takes longer than a configurable threshold or when an error happens.
Checklist
Notes for reviewers:
/AzurePipelines runwill queue all builds/AzurePipelines run <pipeline-name>will queue a specific build