Description
Tracer Version(s)
3.13.0
Operating system and platform
Linux (x64)
Instrumentation Mode
manual with NuGet package
TFM
net8.0
Bug Report
Most of our APIs at my org use ASP.NET API Versioning with its SubstituteApiVersionInUrl
option set to true, and have controllers with routes such as v{version:apiVersion}/helloworld
. Our endpoints in our OpenAPI specs show up as v1/helloworld
, but in Datadog (Endpoints in APM, http.route in the span) they show up like v{version}/helloworld
. Is there any way the tracer could handle that situation better, so Datadog shows the resolved URL of the endpoint? Besides being an annoyance, it breaks the mapping between the API definition in the Software Catalog (which has v1/helloworld
since that's in the OpenAPI spec) and the endpoints on the service page.
Reproduction Code
// Controller
[ApiVersion( 1.0 )]
[Route( "api/v{version:apiVersion}/[controller]" )]
public class HelloWorldController : ControllerBase
{
// GET api/v{version}/helloworld
[HttpGet]
public IActionResult Get( ApiVersion apiVersion ) => Ok( new { Controller = GetType().Name, Version = apiVersion.ToString() } );
}
// Program.cs
builder.Services.AddApiVersioning()
.AddMvc()
.AddApiExplorer(options => options.SubstituteApiVersionInUrl = true);
Example project: https://github.com/dotnet/aspnet-api-versioning/tree/main/examples/AspNetCore/WebApi/OpenApiExample