Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding filter processor after also filter previous processor #5672

Open
abratv opened this issue Jun 5, 2024 · 5 comments
Open

Adding filter processor after also filter previous processor #5672

abratv opened this issue Jun 5, 2024 · 5 comments
Labels
question Further information is requested

Comments

@abratv
Copy link

abratv commented Jun 5, 2024

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 abratv added the question Further information is requested label Jun 5, 2024
@vishweshbankwar
Copy link
Member

@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.

@abratv
Copy link
Author

abratv commented Jun 10, 2024

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"

@cijothomas
Copy link
Member

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?

@abratv
Copy link
Author

abratv commented Jun 11, 2024

I'm bit tight right now

You can check quickly if the traces over the dashboard also got filtered

image

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"

@cijothomas
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants