opentelemetry-dotnet
opentelemetry-dotnet copied to clipboard
Adding filter processor after also filter previous processor
What is the question?
The first registration
builder.Services.AddOpenTelemetry()
.WithMetrics(metrics =>
{
metrics.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddRuntimeInstrumentation();
})
.WithTracing(tracing =>
{
tracing.AddAspNetCoreInstrumentation()
// Uncomment the following line to enable gRPC instrumentation (requires the OpenTelemetry.Instrumentation.GrpcNetClient package)
//.AddGrpcClientInstrumentation()
.AddHttpClientInstrumentation()
.AddSqlClientInstrumentation()
.AddRedisInstrumentation();
});
next
builder.Services.AddOpenTelemetry().WithTracing(tracing =>
{
tracing.AddProcessor(new MyFilterProcessor())
tracing.AddProcessor(new MyProcessor());
});
I was expecting "MyProcessor" should be filtered but what happened is AspNetCoreInstrumentation also filtered
Is this expected?
Additional context
No response
@abratv - could you please elaborate on what you are trying to do?
I was expecting "MyProcessor" should be filtered but what happened is AspNetCoreInstrumentation also filtered
This statement is not clear to me.
Let's say I have following processors
- Processor A
- Processor B
- Processor Filter
- Processor C
Expectation: "Processor Filter" only apply to "Processor C" Actual: "Processor Filter" also applied to "Processor A", "Processor B" and "Processor C"
Let's say I have following processors
- Processor A
- Processor B
- Processor Filter
- Processor C
Expectation: "Processor Filter" only apply to "Processor C" Actual: "Processor Filter" also applied to "Processor A", "Processor B" and "Processor C"
This would be a bug, if ProcessorFilter applied to things before it! Can you share a minimal repro or a unittest to show the behavior you are seeing?
I'm bit tight right now
You can check quickly if the traces over the dashboard also got filtered
or the way I configure it wrong some how?
this is the way i configure my filter
public static IHostApplicationBuilder ConfigureMyTelemetry(this IHostApplicationBuilder builder, Action<TracerProviderBuilder> configure)
{
builder.Services.AddOpenTelemetry().WithTracing(tracing =>
{
configure(tracing);
});
return builder;
}
and in program.cs
//these 2 lines below come from github example
builder.ConfigureOpenTelemetry();
builder.AddDefaultHealthChecks();
//My own telemetry, filter and processor
builder.ConfigureMyTelemetry(trace =>
{
trace.AddProcessor<MyFilterProcessor>();
trace.AddProcessor<MyProcessor>();
});
So MyFilterProcessor also filter configuration in "ConfigurationOpenTelemetry"
https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/trace/extending-the-sdk Please use a minimal example and share the repro code, so it'll be easy for us to confirm you are adding processors correctly.
This issue was marked stale due to lack of activity and will be closed in 7 days. Commenting will instruct the bot to automatically remove the label. This bot runs once per day.
Closed as inactive. Feel free to reopen if this issue is still a concern.