Skip to content

Commit

Permalink
Revert "Adds code to create activity even customer is not subscribed …
Browse files Browse the repository at this point in the history
…to the feature"

This reverts commit 7e7ffaa.
  • Loading branch information
sourabh1007 committed Apr 12, 2024
1 parent 318df77 commit 464c264
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,7 @@ public static OpenTelemetryCoreRecorder CreateRecorder(string operationName,
clientContext: clientContext,
config: requestOptions?.CosmosThresholdOptions ?? clientContext.ClientOptions?.CosmosClientTelemetryOptions.CosmosThresholdOptions);
}
#if !INTERNAL
// If there are no listeners at operation level and no parent activity created.
// Then create a dummy activity as there should be a parent level activity always to send a traceid to the backend services through context propagation.
// The parent activity id logged in diagnostics, can be used for tracing purpose in backend.
if (Activity.Current is null)
{
openTelemetryRecorder = OpenTelemetryCoreRecorder.CreateParentActivity(operationName);
}
#endif

// Safety check as diagnostic logs should not break the code.
if (Activity.Current?.TraceId != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
Expand Down Expand Up @@ -46,9 +47,9 @@ public async Task ClientConfigTest()
Assert.IsNotNull(response.Diagnostics);
ITrace trace = ((CosmosTraceDiagnostics)response.Diagnostics).Value;
#if PREVIEW
Assert.AreEqual(actual: trace.Data.Count, expected: 2, message: string.Join(",", trace.Data.Select(a => $"{a.Key}: {a.Value}"))); // Distributed Tracing Id
Assert.AreEqual(trace.Data.Count, 2, string.Join(",", trace.Data.Select(a => $"{a.Key}: {a.Value}"))); // Distributed Tracing Id
#else
Assert.AreEqual(actual: trace.Data.Count, expected: 1, message: string.Join(",", trace.Data.Select(a => $"{a.Key}: {a.Value}")));
Assert.AreEqual(trace.Data.Count, 1, string.Join(",", trace.Data.Select(a => $"{a.Key}: {a.Value}")));
#endif
ClientConfigurationTraceDatum clientConfigurationTraceDatum = (ClientConfigurationTraceDatum)trace.Data["Client Configuration"];
Assert.IsNotNull(clientConfigurationTraceDatum.UserAgentContainer.UserAgent);
Expand Down

0 comments on commit 464c264

Please sign in to comment.