Register global only if absent #2908
Unanswered
danielgblanco
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hello @danielgblanco . We did consider this option, but considered it potentially more confusing to silently ignore the user's inputs, rather than telling them explicitly that something was not right. And, for testing, we chose to make it explicitly a testing method, rather than a part of the "normal" API. If you have a non-testing use-case where it is necessary to have multiple global-registrations, we'd be happy to consider adding a new method for that. But, in those cases, I think we would strongly encourage users to simply not use the global at all, and maintain their own "global" state if they need it. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We're starting to work on our migration from OpenTracing to OpenTelemetry (initially via shims). Internally, as support multiple engineering teams, we provide a set of internal common libraries across our supported frameworks that deal with setting up various features, including tracing. In Java, using GlobalTracer.registerIfAbsent() played quite nicely with integration tests in apps using these common libs (developers don't need to have knowledge of how the tracer is setup). I'm aware that the OpenTelemetry API provides a GlobalOpenTelemetry.resetForTest() for this specific use case (integration tests), but I wonder if there have been discussions (I've not found any) to do something similar and only register if absent in buildAndRegisterGlobal() or a separate method, and why that was not decided as the best way forward.
Beta Was this translation helpful? Give feedback.
All reactions