You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The resulting trace from calling an endpoint mapped using Minimal Api does not contain the http.route tag, however the tag is present when calling an endpoint defined in a classic controller.
What is the expected behavior?
The trace contains the tag http.route for endpoints created with the Minimal API syntax.
The trace does not contain the http.route tag for endpoints created with the Minimal API syntax.
Reproduce
With the code below call endpoint /does-not-work/1234 and observe that http.route is not present among the tags in the console output. Do the same for /works/1234 and observe that the http.route tag is present among the tags in the console output.
usingMicrosoft.AspNetCore.Mvc;usingOpenTelemetry.Resources;usingOpenTelemetry.Trace;varbuilder=WebApplication.CreateBuilder(args);builder.Services.AddControllers();builder.Services.AddOpenTelemetry().WithTracing(b =>{varresourceBuilder=ResourceBuilder.CreateDefault().AddService("MinimalExample",null,"0.0.1");b.SetResourceBuilder(resourceBuilder).AddAspNetCoreInstrumentation().AddConsoleExporter();});varapp=builder.Build();app.MapControllers();app.MapGet("/does-not-work/{id:int}",(intid)=>"Trace without http.route");app.Run();[ApiController]publicclassTestController:ControllerBase{[HttpGet][Route("/works/{id:int}")]publicIActionResultGetTest(intid){returnOk();}}
I have looked a bit into the source of OpenTelemetry.Instrumentation.AspNetCore and it seems like the OnMvcBeforeActionEvent never occurs when calling the endpoint created with Minimap API syntax. All other expected tags seem to be present.
The issue seems to be the same with both net6.0 and net7.0.
The text was updated successfully, but these errors were encountered:
Bug Report
Packages used:
OpenTelemetry.Exporter.Console 1.4.0-rc.4
OpenTelemetry.Extensions.Hosting 1.4.0-rc.4
OpenTelemetry.Instrumentation.AspNetCore 1.0.0-rc9.13
Runtime versions:
net6.0
net7.0
Symptom
The resulting trace from calling an endpoint mapped using Minimal Api does not contain the
http.route
tag, however the tag is present when calling an endpoint defined in a classic controller.What is the expected behavior?
The trace contains the tag
http.route
for endpoints created with the Minimal API syntax.What is the actual behavior?
The trace does not contain the
http.route
tag for endpoints created with the Minimal API syntax.Reproduce
With the code below call endpoint
/does-not-work/1234
and observe thathttp.route
is not present among the tags in the console output. Do the same for/works/1234
and observe that thehttp.route
tag is present among the tags in the console output.Additional Context
I have looked a bit into the source of
OpenTelemetry.Instrumentation.AspNetCore
and it seems like theOnMvcBeforeActionEvent
never occurs when calling the endpoint created with Minimap API syntax. All other expected tags seem to be present.The issue seems to be the same with both
net6.0
andnet7.0
.The text was updated successfully, but these errors were encountered: