opentelemetry-dotnet
opentelemetry-dotnet copied to clipboard
How can i trace activity in ASP.NET core Filters
Question
How can i trace activity in ASP.NET core Filters
In Startup.cs i added following AddSource
.AddSource(nameof(MyControllerFilter))
...
services.AddOpenTelemetryTracing(builder =>
{
builder.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddEntityFrameworkCoreInstrumentation()
.AddSource(nameof(MyControllerFilter))
.AddSource(nameof(MyController))
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(Configuration["ServiceName"]))
.AddJaegerExporter(opts =>
{
opts.AgentHost = Configuration["Jaeger:AgentHost"];
opts.AgentPort = System.Convert.ToInt32(Configuration["Jaeger:AgentPort"]);
opts.ExportProcessorType = ExportProcessorType.Batch;
});
});
...
MyController.cs
public class MyController : ControllerBase
{
.....
[ServiceFilter(typeof(MyControllerFilter))]
public IActionResult HandleAction([FromQuery] string action)
{
....
}
....
}
but seems it's not working.
Thank you for read my question.
AddSource is meant to add ActivitySources. I dont think this usage is correct.
Take a look at the example asp.net core app, and see if that is what you are looking for. If not, please modify it/create new repro app, explaining which part is not working.
Closing old issues that are not active.