hapifhir/hapi-fhir-jpaserver-starter

Bug: OpenTelemetry java agent startup fails with README.md instructions.

dotasek opened this issue · 1 comments

When starting from docker, there is an exception regarding Jaeger dependencies in the log file.

Here is my startup (I have jaeger running at localhost:14250)

docker run -p 8080:8080 -e JAVA_TOOL_OPTIONS="-javaagent:/app/opentelemetry-javaagent.jar" -e OTEL_TRACES_EXPORTER="jaeger" -e OTEL_SERVICE_NAME="hapi-fhir-server" -e OTEL_EXPORTER_JAEGER_ENDPOINT="http://localhost:14250" <docker-image-id>

This results in the following error in the log:

[otel.javaagent 2024-08-26 15:03:12:412 +0000] [main] INFO io.opentelemetry.exporter.internal.grpc.GrpcExporter - Calling shutdown() multiple times.
OpenTelemetry Javaagent failed to start
io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException: otel.traces.exporter set to "jaeger" but opentelemetry-exporter-jaeger not found on classpath. Make sure to add it as a dependency.
        at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.configureExporter(SpanExporterConfiguration.java:96)
        at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.configureSpanExporters(SpanExporterConfiguration.java:68)
        at io.opentelemetry.sdk.autoconfigure.TracerProviderConfiguration.configureTracerProvider(TracerProviderConfiguration.java:58)
        at io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder.build(AutoConfiguredOpenTelemetrySdkBuilder.java:465)
        at io.opentelemetry.javaagent.tooling.OpenTelemetryInstaller.installOpenTelemetrySdk(OpenTelemetryInstaller.java:34)
        at io.opentelemetry.javaagent.tooling.AgentInstaller.installBytebuddyAgent(AgentInstaller.java:123)
        at io.opentelemetry.javaagent.tooling.AgentInstaller.installBytebuddyAgent(AgentInstaller.java:103)
        at io.opentelemetry.javaagent.tooling.AgentStarterImpl.start(AgentStarterImpl.java:98)
        at io.opentelemetry.javaagent.bootstrap.AgentInitializer$1.run(AgentInitializer.java:53)
        at io.opentelemetry.javaagent.bootstrap.AgentInitializer$1.run(AgentInitializer.java:47)
        at io.opentelemetry.javaagent.bootstrap.AgentInitializer.execute(AgentInitializer.java:68)
        at io.opentelemetry.javaagent.bootstrap.AgentInitializer.initialize(AgentInitializer.java:46)
        at io.opentelemetry.javaagent.OpenTelemetryAgent.startAgent(OpenTelemetryAgent.java:57)
        at io.opentelemetry.javaagent.OpenTelemetryAgent.premain(OpenTelemetryAgent.java:45)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:491)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:503)

It looks like OpenTelemetry has dropped support for the Jaeger exporter: https://opentelemetry.io/blog/2023/jaeger-exporter-collector-migration/

However, Jaeger will apparently support otlp/jaeger, and there are instructions in the link above on how to use that.

When I have some time, I will experiment with setting that value in these instructions, and will try again:

https://github.com/hapifhir/hapi-fhir-jpaserver-starter#enable-opentelemetry-auto-instrumentation