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

[SDK] Support OTEL_SDK_DISABLED environment variable #1631

Open
marcalff opened this issue Sep 23, 2022 · 11 comments
Open

[SDK] Support OTEL_SDK_DISABLED environment variable #1631

marcalff opened this issue Sep 23, 2022 · 11 comments
Assignees
Labels
bug Something isn't working do-not-stale good first issue Good for newcomers help wanted Good for taking. Extra help will be provided by maintainers

Comments

@marcalff
Copy link
Member

The SDK spec recently added a new environment variable, OTEL_SDK_DISABLED

See open-telemetry/opentelemetry-specification#2679

Implement support for OTEL_SDK_DISABLED, for all signals.

@marcalff marcalff added the bug Something isn't working label Sep 23, 2022
@marcalff marcalff self-assigned this Sep 27, 2022
@github-actions
Copy link

This issue was marked as stale due to lack of activity.

@github-actions github-actions bot added the Stale label Nov 27, 2022
@esigo esigo added do-not-stale and removed Stale labels Nov 27, 2022
@marcalff marcalff removed their assignment Oct 21, 2024
@marcalff marcalff added help wanted Good for taking. Extra help will be provided by maintainers good first issue Good for newcomers labels Oct 21, 2024
Copy link

This issue is available for anyone to work on. Make sure to reference this issue in your pull request.
✨ Thank you for your contribution! ✨

@RichardChukwu
Copy link

Is this available to be worked on @marcalff ?

@divenire05
Copy link

divenire05 commented Dec 23, 2024

If no one is working on this, could I take it up? Feel free to assign it to me. @marcalff

@divenire05
Copy link

Thanks, does anyone have any suggestions on getting started with resolving this issue?

@lalitb
Copy link
Member

lalitb commented Dec 27, 2024

Thanks, does anyone have any suggestions on getting started with resolving this issue?

One approach could be to introduce an disabled flag in the TracerProvider. This flag would be set during the provider's initialization, based on the OTEL_SDK_DISABLED environment variable, and default to false. If the flag is set to true, TracerProvider::GetTracer() would return a NoopTracer. This ensures that any changes to the environment variable are reflected in subsequently created tracer and span through this tracer. A similar mechanism could be implemented for logs and metrics.

@divenire05
Copy link

divenire05 commented Dec 28, 2024

Sounds good. Do you know which files I should focus on editing/where I can find them?

@lalitb
Copy link
Member

lalitb commented Dec 28, 2024

tracer_provider.cc/h under sdk directory. And similarly logger_provider/meter_provider.

@divenire05
Copy link

Got it, thank you!

@divenire05
Copy link

divenire05 commented Dec 29, 2024

Would I access the OTEL_SDK_DISABLED variable with getenv("OTEL_SDK_DISABLED")? I looked at open-telemetry/opentelemetry-specification#2679 but I'm unsure where the environment property is specified in the code.

@lalitb
Copy link
Member

lalitb commented Dec 29, 2024

You should be using the cross-platform api to access the env variable -

bool GetBoolEnvironmentVariable(const char *env_var_name, bool &value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working do-not-stale good first issue Good for newcomers help wanted Good for taking. Extra help will be provided by maintainers
Projects
None yet
Development

No branches or pull requests

5 participants