Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HttpClient] Export spans corresponding to retries #3732

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Instrumentation.Http/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

* In case of .NET Core, additional spans created during retries will now be
exported.
([[#3729](https://github.com/open-telemetry/opentelemetry-dotnet/issues/3729)])

## 1.0.0-rc9.7

Released 2022-Sep-29
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ internal static class HttpRequestMessageContextPropagation

internal static Action<HttpRequestMessage, string, string> HeaderValueSetter => (request, name, value) =>
{
request.Headers.Remove(name);
request.Headers.Add(name, value);
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,6 @@ public void OnStartActivity(Activity activity, object payload)
return;
}

// TODO: Investigate why this check is needed.
if (Propagators.DefaultTextMapPropagator.Extract(default, request, HttpRequestMessageContextPropagation.HeaderValuesGetter) != default)
{
// this request is already instrumented, we should back off
activity.IsAllDataRequested = false;
return;
}

// Propagate context irrespective of sampling decision
var textMapPropagator = Propagators.DefaultTextMapPropagator;
if (textMapPropagator is not TraceContextPropagator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public async Task HttpClientInstrumentation_AddViaFactory_HttpInstrumentation_Co
Assert.IsType<Activity>(processor.Invocations[1].Arguments[0]);
}

[Fact(Skip = "https://github.com/open-telemetry/opentelemetry-dotnet/issues/3729")]
[Fact]
public async Task HttpClientInstrumentationExportsSpansCreatedForRetries()
{
var exportedItems = new List<Activity>();
Expand All @@ -321,7 +321,7 @@ public async Task HttpClientInstrumentationExportsSpansCreatedForRetries()
await c.SendAsync(request);

// number of exported spans should be 3(maxRetries)
Assert.Equal(3, exportedItems.Count());
Assert.Equal(maxRetries, exportedItems.Count());

var spanid1 = exportedItems[0].SpanId;
var spanid2 = exportedItems[1].SpanId;
Expand Down