Using OpenTelemetry Library with inspectIT Ocelot
If you plan to use the OpenTelemetry library in an application which will be instrumented later on with inspectIT Ocelot, some special rules do apply. Following these rules will make sure that there are no run-time problems in your application. Furthermore, a correct configuration will make it possible to combine metrics and traces that you manually collect using the OpenTelemetry instrumentation library with the ones collected by the inspectIT Ocelot agent.
Make sure you are using the same version of OpenTelemetry as inspectIT Ocelot.
The inspectIT Ocelot agent in version 2.6.9 internally uses OpenTelemetry in version 1.49.0. Please adapt any OpenTelemetry dependency in your application to this version to avoid runtime conflicts.
<dependency> <groupId>io.opentelemetry</groupId> <artifactId>opentelemetry-api</artifactId> <version>1.49.0</version> </dependency>
Set the JVM property
inspectit.publishOpenTelemetryToBootstrap
totrue
.-Dinspectit.publishOpenTelemetryToBootstrap=true
Setting the above property to
true
tells inspectIT Ocelot that you plan to use the OpenTelemetry library in combination with the agent. Note that this property must be specified with this exact name. The flexibility offered for all other config options does not apply here. The inspectIT Ocelot agent will make sure that all OpenTelemetry classes are then loaded by the bootstrap class loader. This ensures that OpenTelemetry implementation is shared between your manual instrumentation and the agent instrumentation, making the combination of data possible.Add the agent to the start of a JVM
In this scenario, it is required that you add the agent via the
javaagent
JVM argument. If the agent is successfully added to the JVM, it will log that the OpenTelemetry classes pushed to the bootstrap classloader will be used.It is important to state that the agent will not publish the OpenTelemetry classes to the bootstrap classloader if it is attached during runtime – even if the previously mentioned JVM argument is set! In this case, metrics and traces of manual OpenTelemetry instrumentations will not be collected by the inspectIT Ocelot agent.