-
Notifications
You must be signed in to change notification settings - Fork 246
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
feat: Add compatibility with env OTEL_SDK_DISABLED #1773
base: main
Are you sure you want to change the base?
feat: Add compatibility with env OTEL_SDK_DISABLED #1773
Conversation
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.
Thanks for this PR, @pedrofurtado!
There is a test helper, OpenTelemetry::TestHelpers.with_env
that can be used to help test behavior with environment variables.
For example:
opentelemetry-ruby/common/test/opentelemetry/common/utilities_test.rb
Lines 102 to 104 in 84d64ca
OpenTelemetry::TestHelpers.with_env('a' => 'b') do | |
_(common_utils.config_opt('a', default: 'bar')).must_equal('b') | |
end |
I started writing this comment before you removed the test. Could you add a test that leverages this helper?
Co-authored-by: Kayla Reopelle <[email protected]>
@arielvalentin @kaylareopelle I've created a test for this. |
@arielvalentin @kaylareopelle The CI finished, but a rubocop offense was notified. I fixed that, but I need approval again for CI please 😄 |
Thanks for your patience. You'll require approvals to run CI until your first PR is merged. |
Good news, CI is green ✅ |
@@ -61,6 +61,11 @@ module SDK | |||
# c.use_all | |||
# end | |||
def configure | |||
if ENV['OTEL_SDK_DISABLED'] == 'true' |
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.
@robertlaurin is this the best place for us to check this?
Does it make sense to check that in the instance method instead? https://github.com/open-telemetry/opentelemetry-ruby/blob/main/sdk/lib/opentelemetry/sdk/configurator.rb#L144
Do we want to support being able to change the envar and re-initialize in a running program?
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.
Here in our applications works like a charm in this place (using monkey patch).
The PR content was based on this comment: #1605 (comment)
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.
Yes, that was my comment 😄
I reached out to @robertlaurin here since he designed this component and wanted to solicit his input about where this check should happen.
If a user is not using the DSL, they can still create an instance of the Configurator
and call the configure
method bypassing the envar
.
They could also not use the configurator at all and assemble the tracer provider and resources themselves.
I just want to make sure we are hooking this into the appropriate scope, so folks are not surprised that it does not work as anticipated in specific scenarios; or if we are OK with this minimal implementation.
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.
I had similar questions @kaylareopelle to the ones you brought up
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.
thank you! missed this! (link to comment)
The spec for this environment variable feels a little vague to me. Do we know the scope of the The current implementation would skip creating tracer providers through configuration, but someone could still manually create functional tracer providers and tracers. Is that acceptable? I took a look at Python's implementation, and it seems like they always return no-ops when However, Java's implementation seems closer to this approach. Configuration is skipped, but I'm not sure if that means you cannot create working tracers, etc. |
Hi @arielvalentin @kaylareopelle! 👋 |
I don't know. We don't quite understand how this environment variable is supposed to work per the specification. Right now this PR only works in a specific use case. If our users initialize the SDK in a different way, I.e. manual configuration, then the envar will not work as expected and we may get a bug report. That is why we are asking the question about whether or not this check is happening the the correct place. |
I opened an issue in the semantic conventions repo to see if we can get some help clarifying the functionality: open-telemetry/semantic-conventions#1667 Once we understand the spec better, we can move forward. Thanks for your patience, @pedrofurtado! |
@kaylareopelle I think that should be in the spec repo thought right? Not semconv? |
@arielvalentin - Thank you, you're right! 🤦 I'll get that fixed. |
New issue in the right repo! open-telemetry/opentelemetry-specification#4332 Thanks, @arielvalentin! |
feat: Add compatibility with env OTEL_SDK_DISABLED
Currently, the ruby gem does not have compatibility with env
OTEL_SDK_DISABLED
defined in Open Telemetry specification.Specification: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#general-sdk-configuration
This PR adds this integration.