quarkus: OpenTelemetry exporter (otlp) startup dependency error when running as a Docker container image
Describe the bug
Using the OpenTelemetry guide, I’m configuring my Quarkus application to push traces and spans to an external OTel collector endpoint. This works fine when I run the application with ./mvnw quarkus:dev or when running the application through IntelliJ Quarkus Plugin. The application starts and I can verify that the GET /hello API calls result in spans that are pushed to my OTel collector.
However, when I run the same application as a Docker container, it runs into a dependency error during startup. For some reason the startup process is not able to find the “exporter-otlp” classes in the classpath, even though the otlp dependencies opentelemetry-exporter-otlp-common and opentelemetry-exporter-otlp are provided in my pom.xml file (as indicated in OpenTelemetry exporter section).
application.properties file:
quarkus.otel.service.name=opentelemetry-reproducer-test
quarkus.otel.traces.exporter=otlp
quarkus.otel.exporter.otlp.traces.endpoint=http://192.168.0.37:4317
quarkus.otel.exporter.otlp.traces.headers=Authorization=Bearer XXX
Docker container build and run steps:
./mvnw clean package -Dquarkus.container-image.build=true -Dquarkus.container-image.group=acme
docker run --rm --name opentelemetry-reproducer -p 8080:8080 -e QUARKUS_PROFILE=dev acme/opentelemetry-reproducer:1.0.0-SNAPSHOT
Error during startup:
INFO exec -a "java" java -Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -XX:MaxRAMPercentage=50.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:+ExitOnOutOfMemoryError -cp "." -jar /deployments/quarkus-run.jar
__ ____ __ _____ ___ __ ____ ______
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2023-09-06 14:27:21,144 INFO [io.ope.sdk.aut.AutoConfiguredOpenTelemetrySdkBuilder] (main) Error encountered during autoconfiguration. Closing partially configured components.
2023-09-06 14:27:21,179 ERROR [io.qua.run.Application] (main) Failed to start application (with profile [dev]): java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:61)
at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:32)
Caused by: jakarta.enterprise.inject.CreationException: Error creating synthetic bean [2deeb341bce4a230183bf3a228841625fe2519ae]: io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException: otel.traces.exporter set to "otlp" but opentelemetry-exporter-otlp not found on classpath. Make sure to add it as a dependency.
at io.opentelemetry.api.OpenTelemetry_2deeb341bce4a230183bf3a228841625fe2519ae_Synthetic_Bean.doCreate(Unknown Source)
at io.opentelemetry.api.OpenTelemetry_2deeb341bce4a230183bf3a228841625fe2519ae_Synthetic_Bean.create(Unknown Source)
at io.opentelemetry.api.OpenTelemetry_2deeb341bce4a230183bf3a228841625fe2519ae_Synthetic_Bean.create(Unknown Source)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:113)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:37)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:34)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:32)
at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:34)
at io.opentelemetry.api.OpenTelemetry_2deeb341bce4a230183bf3a228841625fe2519ae_Synthetic_Bean.get(Unknown Source)
at io.opentelemetry.api.OpenTelemetry_2deeb341bce4a230183bf3a228841625fe2519ae_Synthetic_Bean.get(Unknown Source)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:557)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:537)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:570)
at io.quarkus.arc.impl.ArcContainerImpl$3.get(ArcContainerImpl.java:334)
at io.quarkus.arc.impl.ArcContainerImpl$3.get(ArcContainerImpl.java:331)
at io.quarkus.arc.runtime.BeanContainerImpl$1.create(BeanContainerImpl.java:46)
at io.quarkus.arc.runtime.BeanContainer.beanInstance(BeanContainer.java:25)
at io.quarkus.opentelemetry.runtime.tracing.intrumentation.InstrumentationRecorder.setupVertxTracer(InstrumentationRecorder.java:33)
at io.quarkus.deployment.steps.OpenTelemetryProcessor$setupVertx280172193.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.OpenTelemetryProcessor$setupVertx280172193.deploy(Unknown Source)
... 13 more
Caused by: io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException: otel.traces.exporter set to "otlp" but opentelemetry-exporter-otlp not found on classpath. Make sure to add it as a dependency.
at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.configureExporter(SpanExporterConfiguration.java:95)
at io.opentelemetry.sdk.autoconfigure.SpanExporterConfiguration.configureSpanExporters(SpanExporterConfiguration.java:66)
at io.opentelemetry.sdk.autoconfigure.TracerProviderConfiguration.configureTracerProvider(TracerProviderConfiguration.java:51)
at io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder.build(AutoConfiguredOpenTelemetrySdkBuilder.java:356)
at io.quarkus.opentelemetry.runtime.OpenTelemetryRecorder$1.apply(OpenTelemetryRecorder.java:79)
at io.quarkus.opentelemetry.runtime.OpenTelemetryRecorder$1.apply(OpenTelemetryRecorder.java:52)
at io.opentelemetry.api.OpenTelemetry_2deeb341bce4a230183bf3a228841625fe2519ae_Synthetic_Bean.createSynthetic(Unknown Source)
... 34 more
Expected behavior
Application startup is successful regardless of how it’s ran (i.e through Maven, IDE or as a Docker container)
Actual behavior
Application startup is successful when running through Maven or IDE, but it fails when it’s ran as a Docker container
How to Reproduce?
- Clone the reproducer Quarkus project: https://github.com/yunusevren/opentelemetry-reproducer
git clone git@github.com:yunusevren/opentelemetry-reproducer.git
cd opentelemetry-reproducer- Run with
./mvnw quarkus:dev. Observe successful startup. - Stop the application
- Run as Docker container:
- Build image:
./mvnw clean package -Dquarkus.container-image.build=true -Dquarkus.container-image.group=acme - Run:
docker run --rm --name opentelemetry-reproducer -p 8080:8080 -e QUARKUS_PROFILE=dev acme/opentelemetry-reproducer:1.0.0-SNAPSHOT - Startup fails with errors
- Build image:
Output of uname -a or ver
Darwin xxxxxxxx.local 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64
Output of java -version
openjdk 11.0.17 2022-10-18 OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8) OpenJDK 64-Bit Server VM Temurin-11.0.17+8 (build 11.0.17+8, mixed mode)
GraalVM version (if different from Java)
N/A
Quarkus version or git rev
3.3.1
Build tool (ie. output of mvnw --version or gradlew --version)
Apache Maven 3.9.3 (21122926829f1ead511c958d89bd2f672198ae9f) Maven home: /Users/xxxxxxxx/.m2/wrapper/dists/apache-maven-3.9.3-bin/326f10f4/apache-maven-3.9.3 Java version: 11.0.17, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home Default locale: en_TR, platform encoding: UTF-8 OS name: “mac os x”, version: “13.5.1”, arch: “aarch64”, family: “mac”
Additional information
Docker version 24.0.2, build cb74dfc
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 16 (10 by maintainers)
Commits related to this issue
- Only remove OTLP trace services when otlp is not configured Fixes: #35786 — committed to geoand/quarkus by geoand 10 months ago
- Merge pull request #35862 from geoand/#35786 Only remove OTLP trace services when otlp is not configured — committed to quarkusio/quarkus by geoand 10 months ago
- Only remove OTLP trace services when otlp is not configured Fixes: #35786 (cherry picked from commit da9997d005c0e23e1fe1fdd1c4e61e1e8ae062dd) — committed to gsmet/quarkus by geoand 10 months ago
- chore(deps): update all non-major dependencies (mulk/quarkus-googlecloud-jsonlogging!18) This MR contains the following updates: | Package | Type | Update | Change | |---------|------|--------|-----... — committed to benkard/quarkus-googlecloud-jsonlogging by deleted user 9 months ago
- Update all non-major dependencies (mulk/mulkcms2!39) This MR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [io.hypersistence:hypersistence-utils-hibernate-... — committed to benkard/mulkcms2 by deleted user 9 months ago
This is because we are using a new exporter from 3.3.0+ You don’t need to set
quarkus.otel.traces.exporter=otlpor add theopentelemetry-exporter-otlp-commonandopentelemetry-exporter-otlpdependencies to the pom. Remove them and you will be using the default.I’m looking into this, regardless.
/cc @brunobat (opentelemetry), @radcortez (opentelemetry)