Split global functionality into a separate class#2233
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2233 +/- ##
============================================
- Coverage 87.82% 87.70% -0.13%
+ Complexity 2431 2429 -2
============================================
Files 268 270 +2
Lines 8157 8163 +6
Branches 906 906
============================================
- Hits 7164 7159 -5
- Misses 660 672 +12
+ Partials 333 332 -1
Continue to review full report at Codecov.
|
| * @see MeterProvider | ||
| * @see ContextPropagators | ||
| */ | ||
| public final class GlobalOpenTelemetry { |
There was a problem hiding this comment.
This is a big improvement. I think we need to compare with removing the getGlobalTracer type methods in favor of OpenTelemetry.get().getTracer() or OpenTelemetry.getGlobal().getTracer() or getGlobalOpentelemetry().getTracer() (static import). I think they're all fine, latter might lead to more testable user code by reducing the number of static methods involved.
There was a problem hiding this comment.
I would still not have the "global" functionality on the interface OpenTelemetry. Having this separation is a win in my opinion. Not sure I understand what comparison you are asking me to do.
There was a problem hiding this comment.
@anuraaga any further thoughts at this point? I'm inclined to this this PR the 👍 , but want to make sure your concerns are considered.
|
I think this is a fantastic change. It's definitely a big breaking change, though. Should we go through a deprecation cycle on the global methods on the OpenTelemetry API to give users a chance to adapt? This seems like a big enough break that it warrants a deprecation cycle. |
|
@jkwatson done. |
|
@bogdandrutu this needs a rebase. Thanks! |
This ensure clear separation of functionality. This PR does not change any functionality, it just restructures the code to separate global functionality from the Default implementation. Also helps to ensure that Global initialization does not happen by mistake when working only with the default implementation. Also it helps with methods like `OpenTelemetry.get()` and `OpenTelemetry.set()` to understand they are interacting with global instance Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
|
@jkwatson done. |
This ensure clear separation of functionality. This PR does not change any functionality, it just restructures the code to separate global functionality from the Default implementation. Also helps to ensure that Global initialization does not happen by mistake when working only with the default implementation. Also it helps with methods like `OpenTelemetry.get()` and `OpenTelemetry.set()` to understand they are interacting with global instance Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This ensure clear separation of functionality. This PR does not change any functionality, it just restructures the code to separate global functionality from the Default implementation. Also helps to ensure that Global initialization does not happen by mistake when working only with the default implementation. Also it helps with methods like `OpenTelemetry.get()` and `OpenTelemetry.set()` to understand they are interacting with global instance Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This ensure clear separation of functionality. This PR does not change any functionality, it just restructures the code to separate global functionality from the Default implementation. Also helps to ensure that Global initialization does not happen by mistake when working only with the default implementation. Also it helps with methods like `OpenTelemetry.get()` and `OpenTelemetry.set()` to understand they are interacting with global instance Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This ensure clear separation of functionality. This PR does not change any functionality, it just restructures the code to separate global functionality from
the Default implementation. Also helps to ensure that Global initialization does not happen by mistake when working only with the default implementation.
Also it helps with methods like
OpenTelemetry.get()andOpenTelemetry.set()to understand they are interacting with global instanceSigned-off-by: Bogdan Drutu bogdandrutu@gmail.com