Skip to content

Commit 9dd669c

Browse files
committed
temp: add debug tags
1 parent 27ba999 commit 9dd669c

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/Http/HttpClient/HttpMessageHandlerCommon.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ public static CallTargetState OnMethodBegin<TTarget, TRequest>(TTarget instance,
4242
var context = new PropagationContext(scope.Span.Context, Baggage.Current);
4343
tracer.TracerManager.SpanContextPropagator.Inject(context, new HttpHeadersCollection(headers));
4444

45+
// Temporary debug tags
46+
scope.Span.SetTag("http_headers_injected", "true");
47+
scope.Span.SetTag("http_trace_id", scope.Span.Context.RawTraceId);
48+
scope.Span.SetTag("http_span_id", scope.Span.Context.RawSpanId);
49+
4550
tracer.TracerManager.Telemetry.IntegrationGeneratedSpan(implementationIntegrationId ?? integrationId);
4651
return new CallTargetState(scope);
4752
}

tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/Http/HttpClient/SocketsHttpHandler/YarpForwarderHttpClientFactoryIntegration.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ internal static CallTargetState OnMethodBegin<TTarget, TArg1>(TTarget instance,
6464
/// <returns>A return value, in an async scenario will be T of Task of T</returns>
6565
internal static CallTargetReturn OnMethodEnd<TTarget>(TTarget instance, Exception exception, in CallTargetState state)
6666
{
67+
// Temporary debug tag
68+
if (Tracer.Instance.ActiveScope is { Span: var span })
69+
{
70+
span.SetTag("http_yarp_integration_called", "true");
71+
}
72+
6773
// On net6.0+, the proxy will inject the current Activity into the request headers, using the propagator
6874
// stored in the SocketsHttpHandler.ActivityHeadersPropagator field. This will overwrite the propagation
6975
// headers that have already been set by our Datadog tracer's HttpClient instrumentation.
@@ -72,6 +78,12 @@ internal static CallTargetReturn OnMethodEnd<TTarget>(TTarget instance, Exceptio
7278
if (state.State is System.Net.Http.SocketsHttpHandler handler)
7379
{
7480
handler.ActivityHeadersPropagator = DistributedContextPropagator.CreateNoOutputPropagator();
81+
82+
// Temporary debug tag
83+
if (Tracer.Instance.ActiveScope is { Span: var span2 })
84+
{
85+
span2.SetTag("http_yarp_propagator_disabled", "true");
86+
}
7587
}
7688

7789
return CallTargetReturn.GetDefault();

0 commit comments

Comments
 (0)