Skip to content

Commit

Permalink
Merge branch 'master' into users/philipthomas-MSFT/3340
Browse files Browse the repository at this point in the history
  • Loading branch information
philipthomas-MSFT committed May 18, 2023
2 parents 59d0ccd + c66e488 commit 8b4a925
Show file tree
Hide file tree
Showing 16 changed files with 4,639 additions and 577 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public static OpenTelemetryCoreRecorder CreateRecorder(string operationName,
{
if (clientContext is { ClientOptions.IsDistributedTracingEnabled: true })
{
OpenTelemetryRecorderFactory.ScopeFactory ??= new DiagnosticScopeFactory(clientNamespace: OpenTelemetryAttributeKeys.DiagnosticNamespace,
OpenTelemetryRecorderFactory.ScopeFactory ??= new DiagnosticScopeFactory(clientNamespace: $"{OpenTelemetryAttributeKeys.DiagnosticNamespace}.{OpenTelemetryAttributeKeys.OperationPrefix}",
resourceProviderNamespace: OpenTelemetryAttributeKeys.ResourceProviderNamespace,
isActivityEnabled: true,
suppressNestedClientActivities: true);

// If there is no source then it will return default otherwise a valid diagnostic scope
DiagnosticScope scope = OpenTelemetryRecorderFactory
.ScopeFactory
.CreateScope(name: $"{OpenTelemetryAttributeKeys.OperationPrefix}.{operationName}",
.CreateScope(name: operationName,
kind: clientContext.ClientOptions.ConnectionMode == ConnectionMode.Gateway ? DiagnosticScope.ActivityKind.Internal : DiagnosticScope.ActivityKind.Client);

// Record values only when we have a valid Diagnostic Scope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,31 @@
]
}
]
}]]></Json>
<OTelActivities><ACTIVITY><OPERATION>Operation.ExecuteAsync</OPERATION><ATTRIBUTE-KEY>az.namespace</ATTRIBUTE-KEY><ATTRIBUTE-VALUE>Microsoft.DocumentDB</ATTRIBUTE-VALUE><ATTRIBUTE-KEY>az.schema_url</ATTRIBUTE-KEY><ATTRIBUTE-KEY>db.operation</ATTRIBUTE-KEY><ATTRIBUTE-VALUE>ExecuteAsync</ATTRIBUTE-VALUE><ATTRIBUTE-KEY>db.name</ATTRIBUTE-KEY><ATTRIBUTE-KEY>db.cosmosdb.container</ATTRIBUTE-KEY><ATTRIBUTE-KEY>db.system</ATTRIBUTE-KEY><ATTRIBUTE-VALUE>cosmosdb</ATTRIBUTE-VALUE><ATTRIBUTE-KEY>db.cosmosdb.machine_id</ATTRIBUTE-KEY><ATTRIBUTE-KEY>net.peer.name</ATTRIBUTE-KEY><ATTRIBUTE-VALUE>127.0.0.1</ATTRIBUTE-VALUE><ATTRIBUTE-KEY>db.cosmosdb.client_id</ATTRIBUTE-KEY><ATTRIBUTE-KEY>user_agent.original</ATTRIBUTE-KEY><ATTRIBUTE-KEY>db.cosmosdb.connection_mode</ATTRIBUTE-KEY><ATTRIBUTE-VALUE>Direct</ATTRIBUTE-VALUE><ATTRIBUTE-KEY>db.cosmosdb.operation_type</ATTRIBUTE-KEY><ATTRIBUTE-VALUE>Batch</ATTRIBUTE-VALUE><ATTRIBUTE-KEY>db.cosmosdb.request_content_length_bytes</ATTRIBUTE-KEY><ATTRIBUTE-KEY>db.cosmosdb.response_content_length_bytes</ATTRIBUTE-KEY><ATTRIBUTE-KEY>db.cosmosdb.status_code</ATTRIBUTE-KEY><ATTRIBUTE-KEY>db.cosmosdb.sub_status_code</ATTRIBUTE-KEY><ATTRIBUTE-KEY>db.cosmosdb.request_charge</ATTRIBUTE-KEY><ATTRIBUTE-KEY>db.cosmosdb.item_count</ATTRIBUTE-KEY><ATTRIBUTE-KEY>db.cosmosdb.activity_id</ATTRIBUTE-KEY><ATTRIBUTE-KEY>db.cosmosdb.correlated_activity_id</ATTRIBUTE-KEY><ATTRIBUTE-KEY>db.cosmosdb.regions_contacted</ATTRIBUTE-KEY><ATTRIBUTE-VALUE>South Central US</ATTRIBUTE-VALUE></ACTIVITY>
<EVENT><EVENT-NAME>LatencyOverThreshold</EVENT-NAME><EVENT-TEXT>Ideally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test.</EVENT-TEXT></EVENT>
</OTelActivities>
</Output>
}]]></Json><OTelActivities>
<ACTIVITY source="Azure.Cosmos.Operation" operationName="ExecuteAsync" displayName="ExecuteAsync">
<ATTRIBUTE key="az.namespace">Microsoft.DocumentDB</ATTRIBUTE>
<ATTRIBUTE key="az.schema_url">https://opentelemetry.io/schemas/1.17.0</ATTRIBUTE>
<ATTRIBUTE key="db.operation">ExecuteAsync</ATTRIBUTE>
<ATTRIBUTE key="db.name">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.container">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.system">cosmosdb</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.machine_id">Some Value</ATTRIBUTE>
<ATTRIBUTE key="net.peer.name">127.0.0.1</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.client_id">Some Value</ATTRIBUTE>
<ATTRIBUTE key="user_agent.original">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.connection_mode">Direct</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.operation_type">Batch</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.request_content_length_bytes">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.response_content_length_bytes">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.status_code">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.sub_status_code">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.request_charge">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.item_count">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.activity_id">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.correlated_activity_id">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.regions_contacted">South Central US</ATTRIBUTE>
</ACTIVITY>
<EVENT name="LatencyOverThreshold" />
</OTelActivities></Output>
</Result>
</Results>
Loading

0 comments on commit 8b4a925

Please sign in to comment.