reverse tracestate changes - base SDK has a bug
This commit is contained in:
Родитель
d794387237
Коммит
3b7ee4d15d
|
@ -47,5 +47,8 @@
|
|||
public const char TracestateAzureSeparator = ';';
|
||||
|
||||
internal const string LegacyRootPropertyIdKey = "ai_legacyRootId";
|
||||
|
||||
// TODO[tracestate]: remove, this is done in base SDK
|
||||
internal const string TracestatePropertyKey = "tracestate";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -402,6 +402,12 @@ namespace Microsoft.ApplicationInsights.DependencyCollector.Implementation
|
|||
}
|
||||
}
|
||||
|
||||
// TODO[tracestate]: remove, this is done in base SDK
|
||||
if (!string.IsNullOrEmpty(currentActivity.TraceStateString) && !telemetry.Properties.ContainsKey(W3CConstants.TracestatePropertyKey))
|
||||
{
|
||||
telemetry.Properties.Add(W3CConstants.TracestatePropertyKey, currentActivity.TraceStateString);
|
||||
}
|
||||
|
||||
this.client.Initialize(telemetry);
|
||||
|
||||
// If we started auxiliary Activity before to override the Id with W3C compatible one,
|
||||
|
@ -453,6 +459,13 @@ namespace Microsoft.ApplicationInsights.DependencyCollector.Implementation
|
|||
|
||||
var dependency = this.client.StartOperation<DependencyTelemetry>(resourceName);
|
||||
|
||||
// TODO[tracestate]: remove, this is done in base SDK
|
||||
var tracestate = Activity.Current?.TraceStateString;
|
||||
if (!string.IsNullOrEmpty(tracestate) && !dependency.Telemetry.Properties.ContainsKey(W3CConstants.TracestatePropertyKey))
|
||||
{
|
||||
dependency.Telemetry.Properties.Add(W3CConstants.TracestatePropertyKey, tracestate);
|
||||
}
|
||||
|
||||
dependency.Telemetry.Target = DependencyTargetNameHelper.GetDependencyTargetName(requestUri);
|
||||
dependency.Telemetry.Type = RemoteDependencyConstants.HTTP;
|
||||
dependency.Telemetry.Data = requestUri.OriginalString;
|
||||
|
|
|
@ -59,6 +59,12 @@
|
|||
}
|
||||
|
||||
telemetry.Id = W3CUtilities.FormatTelemetryId(context.Operation.Id, activity.SpanId.ToHexString());
|
||||
|
||||
// TODO[tracestate]: remove, this is done in base SDK
|
||||
if (activity.TraceStateString != null && !telemetry.Properties.ContainsKey(W3CConstants.TracestatePropertyKey))
|
||||
{
|
||||
telemetry.Properties.Add(W3CConstants.TracestatePropertyKey, activity.TraceStateString);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -63,6 +63,12 @@
|
|||
}
|
||||
|
||||
telemetry.Id = W3CUtilities.FormatTelemetryId(traceId, activity.SpanId.ToHexString());
|
||||
|
||||
// TODO[tracestate]: remove, this is done in base SDK
|
||||
if (!string.IsNullOrEmpty(activity.TraceStateString) && !telemetry.Properties.ContainsKey(W3CConstants.TracestatePropertyKey))
|
||||
{
|
||||
telemetry.Properties.Add(W3CConstants.TracestatePropertyKey, activity.TraceStateString);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -90,6 +90,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
// TODO[tracestate]: remove, this is done in base SDK
|
||||
if (!string.IsNullOrEmpty(currentActivity.TraceStateString))
|
||||
{
|
||||
result.Properties[W3CConstants.TracestatePropertyKey] = currentActivity.TraceStateString;
|
||||
}
|
||||
|
||||
result.Id = W3CUtilities.FormatTelemetryId(requestContext.Id, currentActivity.SpanId.ToHexString());
|
||||
}
|
||||
else
|
||||
|
|
Загрузка…
Ссылка в новой задаче