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

Easy way to disable selected instrumentations? #3871

Open
gao-artur opened this issue Nov 8, 2022 · 3 comments
Open

Easy way to disable selected instrumentations? #3871

gao-artur opened this issue Nov 8, 2022 · 3 comments
Labels
question Further information is requested

Comments

@gao-artur
Copy link

We can disable the whole OTel using an environment variable OTEL_SDK_DISABLED=true. But is there an easy built-in solution to disable selected instrumentations using environment variables or another configuration source? For example, I have the following setup:

services.AddOpenTelemetryTracing(builder => builder
    .SetResourceBuilder(ResourceBuilder
        .CreateDefault()
        .AddService(
            _hostEnvironment.ApplicationName,
            serviceVersion: typeof(Startup).Assembly.GetName().Version?.ToString()))
    .AddOtlpExporter()
    .AddAspNetCoreInstrumentation()
    .AddHttpClientInstrumentation()
    .AddGrpcClientInstrumentation(options => options.SuppressDownstreamInstrumentation = true)
    .AddElasticsearchClientInstrumentation(options => options.SuppressDownstreamInstrumentation = true)
    .AddEntityFrameworkCoreInstrumentation());

And I want to be able to disable the Elasticsearch and EF Core instrumentations.

@gao-artur gao-artur added the question Further information is requested label Nov 8, 2022
@Kielek
Copy link
Contributor

Kielek commented Nov 8, 2022

You could try to use Automatic Instrumentation: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation
There is no feature to disable instrumentation by env. vars. when you set up it programmatically.

More info under: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docs/config.md#instrumentations

@gao-artur
Copy link
Author

The docs say automatic instrumentation is in the early stages of development. I'd prefer to avoid using it in production before a stable version is released.

@julealgon
Copy link

We can disable the whole OTel using an environment variable OTEL_SDK_DISABLED=true.

This is not correct, at least not yet:

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