-
Notifications
You must be signed in to change notification settings - Fork 858
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
Registries created through builders should be returned by OpenTelemetry static methods #747
Comments
Relates to PR #724 An alternate approach could be similar to log4j 2.x. |
So, if something like #724 was in place, then you could use the setter to assign to the global OpenTelemetry instance. I wouldn't expect that the builder would do that itself. For Spring, it would probably make sense for some sort of helper class in the Spring integration would call the setter on the global instance to assign it. Do think think that's a viable approach? I'd be happy to have an alternative proposal to #724 to enable this functionality, as well. |
In Spring, it will be the auto-configuration mechanism which would use the build to create a TracerFactory, etc, then set using the static setter in OpenTelemetry, and then return the built TracerFactory as a bean. At that point, whether TracerFactory is injected by Spring or retrieved using OpenTelemetry.getTracerFactory() the same instance would be seen. The only thing I am concerned about with this approach is if the static method gets called before the Spring lifecycle makes the bean available. I want to think some more on how that may be handled. |
I'm almost 100% sure this would be addressed by #1737 . 🤞 |
TracerSdkRegistry, MeterSdkRegistry and DistributedContextManagerSdk objects created programmatically using the builders and intended to be global registries should be returned by the static methods of the OpenTelemetry class. Currently new registry objects with default configuration get created using the Java ServiceLoader mechanism. This should be the fallback if they are not set explicitly.
The text was updated successfully, but these errors were encountered: