Description
Is your feature request related to a problem? Please describe.
As a Java library developer, I want to use native instrumentation. For library developers, the context of library is not know. So the developer don't know if a Java Agent is used, or if the library is used by a Spring application.
There is no clear advice how to obtain an instance of OpenTelemetry
.
According to the documentation. GlobalOpenTelemetry.get()
should not be used, only in the context of Java Agent.
It's also not possible to detect if GlobalOpenTelemetry
is initialized, so that get()
can be used safely.
Some other recommendation is to enable the user of the library to set the OpenTelemetry
instance. But this requires, that the user of a library has to know it. This is difficult, especially in case of nested dependencies.
Describe the solution you'd like
As a library developer, I would like to get a clear advice how to retrieve the OpenTelemetry
instance without making assumptions about the usage of the library.
Describe alternatives you've considered
Additional context