Skip to content

Make it possible to disable specific signals when using auto-instrumentation #4395

Open
@MaxShvets

Description

@MaxShvets

Is your feature request related to a problem?

I'll describe this in terms of disabling metrics, because that's the issue that vexes me the most, but this should be applicable to other signals as well

I use OpenTelemetry purely for tracing and I'd like as little as possible instrumentation code to run for other signals. This is both for performance reasons (though the impact is not that big) and because certain instrumentations can emit warnings related to the other signals, which I'd have to silence (a good example of that is the aiohttp-server instrumentation, which gets the same meters for each request, resulting in "meter already exists warnings").

Describe the solution you'd like

opentelemetry-instrument has the --meter_provider arguments(and corresponding env var), which is ignored, as far as I can see (configuration code uses MeterProvider unconditionally). These could accept the none value, and the auto-instrumentation code would react by selecting the NoOpMeterProvider. As is, this wouldn't help with the aiohttp-server issue described above, because NoOpMeter still emits warnings, so I think it should also be changed, to emit no warnings.

Describe alternatives you've considered

I don't think there are better alternatives, since it seems like some instrumentations (again aiohttp-server is an example) are implemented in a way where you can't choose which signals to instrument. So, to continue to work they should at least be able to get meters (and corresponding objects for other signals) and create metric objects. Which is why, I think, using the no-op versions of these objects, and having the no-op objects emit no warnings is the best we can do

Additional Context

No response

Would you like to implement a fix?

Yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions