-
Notifications
You must be signed in to change notification settings - Fork 831
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
Add APIs to determine if tracer, logger, instruments are enabled #6502
Conversation
…y-java into scope-enabled-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like there's a mix of boolean isEnabled()
and boolean enabled()
Good call! Resolved. |
Is the title of this PR correct? Is this just a stepping stone toward being able to have API disabled via some sort of configuration, per scope? |
There's already (experimental) SDK config to disable scopes. This adds (experimental) API surface area which allows instrumentation to inspect whether a scope is disabled, and if yes, avoid unnecessary computation in recording instrumentation. The idea of having easier SDK configuration for disabling these (i.e. file config, or something else) is independent and not addressed by this. |
So...is the title of this PR incorrect, then? |
I'm not following.. This PR does add an API to check if a particular scope is enabled. |
It might do that indirectly; what it does is add APIs to see if a given tracer/instrument/logger is enabled. Those can be scope associated, but don't have to be. /shrug |
Ahh I see. We're talking past each other on language. I use the phrase "scope" to refer to the concept of tracer / logger / meter collectively, since tracer / logger / meter are the signal-specific terms for scope. Admittedly, its a bit imprecise. I'll update the PR title. |
Yep! I like the new PR title better, as I think it will cause less confusion for everybody in the future. Also, "Scope" is used in the Context APIs, which also could lead to confusion. What API will actually allow users to enable/disable these things, BTW? |
An experimental API for this already exists. See ScopeConfiguratorTest, LoggerConfigTest, MeterConfigTest, TracerConfigTest for usage details. Ergonomics will improve once the API is stabilized. |
Followup to #6497.
Spec PRs open-telemetry/opentelemetry-specification#4063 and open-telemetry/opentelemetry-specification#4020 extended the SDK scope config options with corresponding APIs, which can be called to avoid unnecessary computation recording telemetry when the SDK isn't going to do anything with it.