Scopes not being applied to Spans when using ASP.NET Core with OTel #3220
Closed
Description
This code:
app.MapGet("/hello", async context =>
{
SentrySdk.ConfigureScope(scope =>
{
scope.AddBreadcrumb("Saying hello...");
scope.SetTag("Greeting", "Hello");
using var task = SampleTelemetry.ActivitySource.StartActivity("Greet");
task?.SetTag("Answer", 42);
Thread.Sleep(100); // simulate some work
});
await context.Response.WriteAsync("Hey bro!");
});
Neither the Tags nor the Breadcrumbs flow through to Sentry.
This is because the _hub
being resolved here is a HubAdapter
rather than a plain old Hub
:
sentry-dotnet/src/Sentry.OpenTelemetry/SentrySpanProcessor.cs
Lines 195 to 198 in a448cc4
So that logic for resolving the Hub needs to be improved.
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done
Activity