-
Notifications
You must be signed in to change notification settings - Fork 849
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Considering the following example:
using System.Diagnostics;
using Microsoft.AspNetCore.Http.Features;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddOpenTelemetry()
.WithTracing(builder =>
{
builder
.SetSampler(new AlwaysOnSampler()) // note here I use the AlwaysOn sampler to always record and sample activities
.AddAspNetCoreInstrumentation()
.AddConsoleExporter();
});
var app = builder.Build();
app.MapGet("/values", (HttpContext context) =>
{
var activity = context.Features.GetRequiredFeature<IHttpActivityFeature>().Activity;
activity.SetTag("test", "123");
Activity.Current?.SetTag("test2", "123");
return Results.Ok();
});
app.Run();When the application receives a traceparent header with a trace-flags 00 (not sampled),activity.Id and Activity.Current.Id don't have the same id but both activities have the same name: Microsoft.AspNetCore.Hosting.HttpRequestIn.
In addition, only tags added through Activity.Current.SetTag are taken into account.
This seems to be a bug or an unexpected behaviour with the OpenTelemetry SDK as without the SDK both activities are the same and both tags are taken into account.
What is the expected behavior?
Both activities (the one from IHttpActivityFeature.Activity and the one from Activity.Current) should be the same.
What is the actual behavior?
Both activities are not the same.
cijothomas and mousse-tachemousse-tache
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
