Skip to content

OpenTelemetry extension fails when disables at build time #44879

Open
@brunobat

Description

Describe the bug

When disabling the 3 OTel signals individually at build time, the app startup fails.

See zulip discussion: https://quarkusio.zulipchat.com/#narrow/channel/187038-dev/topic/metricat/near/485675219

Expected behavior

Application starts without OpenTelemetry enabled at build time.

Actual behavior

An exception happens:

ERROR [io.qua.run.Application] (Quarkus Main Thread) <> Failed to start application: 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:121)
    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.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:116)
    at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.NoClassDefFoundError: okhttp3/Interceptor
    at io.opentelemetry.exporter.sender.okhttp.internal.OkHttpHttpSenderProvider.createSender(OkHttpHttpSenderProvider.java:43)
    at io.opentelemetry.exporter.internal.http.HttpExporterBuilder.build(HttpExporterBuilder.java:191)
    at io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder.build(OtlpHttpMetricExporterBuilder.java:269)
    at io.opentelemetry.exporter.otlp.internal.OtlpMetricExporterProvider.createExporter(OtlpMetricExporterProvider.java:53)
    at io.opentelemetry.sdk.autoconfigure.internal.SpiHelper.lambda$loadConfigurable$0(SpiHelper.java:75)
    at io.opentelemetry.sdk.autoconfigure.internal.NamedSpiManager.tryLoadImplementationForName(NamedSpiManager.java:51)
    at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
    at io.opentelemetry.sdk.autoconfigure.internal.NamedSpiManager.getByName(NamedSpiManager.java:41)
    at io.opentelemetry.sdk.autoconfigure.MetricExporterConfiguration.configureExporter(MetricExporterConfiguration.java:133)
    at io.opentelemetry.sdk.autoconfigure.MetricExporterConfiguration.configureReader(MetricExporterConfiguration.java:53)
    at io.opentelemetry.sdk.autoconfigure.MeterProviderConfiguration.lambda$configureMetricReaders$2(MeterProviderConfiguration.java:92)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1715)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
    at io.opentelemetry.sdk.autoconfigure.MeterProviderConfiguration.configureMetricReaders(MeterProviderConfiguration.java:99)
    at io.opentelemetry.sdk.autoconfigure.MeterProviderConfiguration.configureMeterProvider(MeterProviderConfiguration.java:61)
    at io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder.build(AutoConfiguredOpenTelemetrySdkBuilder.java:452)
    at io.quarkus.opentelemetry.runtime.OpenTelemetryRecorder$1.apply(OpenTelemetryRecorder.java:81)
    at io.quarkus.opentelemetry.runtime.OpenTelemetryRecorder$1.apply(OpenTelemetryRecorder.java:54)
    at io.opentelemetry.api.OpenTelemetry_Le6zQbzkojAYO_OiKIQWJf4lGa4_Synthetic_Bean.createSynthetic(Unknown Source)
    at io.opentelemetry.api.OpenTelemetry_Le6zQbzkojAYO_OiKIQWJf4lGa4_Synthetic_Bean.doCreate(Unknown Source)
    at io.opentelemetry.api.OpenTelemetry_Le6zQbzkojAYO_OiKIQWJf4lGa4_Synthetic_Bean.create(Unknown Source)
    at io.opentelemetry.api.OpenTelemetry_Le6zQbzkojAYO_OiKIQWJf4lGa4_Synthetic_Bean.create(Unknown Source)
    at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:119)
    at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:38)
    at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
    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.ComputingCacheContextInstances.computeIfAbsent(ComputingCacheContextInstances.java:19)
    at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:35)
    at io.opentelemetry.api.OpenTelemetry_Le6zQbzkojAYO_OiKIQWJf4lGa4_Synthetic_Bean.get(Unknown Source)
    at io.opentelemetry.api.OpenTelemetry_Le6zQbzkojAYO_OiKIQWJf4lGa4_Synthetic_Bean.get(Unknown Source)
    at io.quarkus.arc.impl.InstanceImpl.getBeanInstance(InstanceImpl.java:325)
    at io.quarkus.arc.impl.InstanceImpl.getInternal(InstanceImpl.java:309)
    at io.quarkus.arc.impl.InstanceImpl.get(InstanceImpl.java:190)
    at io.quarkus.arc.runtime.BeanContainerImpl.beanInstance(BeanContainerImpl.java:26)
    at io.quarkus.opentelemetry.runtime.tracing.intrumentation.InstrumentationRecorder.setupVertxTracer(InstrumentationRecorder.java:59)
    at io.quarkus.deployment.steps.OpenTelemetryProcessor$setupVertx1012958309.deploy_0(Unknown Source)
    at io.quarkus.deployment.steps.OpenTelemetryProcessor$setupVertx1012958309.deploy(Unknown Source)
    ... 11 more
Caused by: java.lang.ClassNotFoundException: okhttp3.Interceptor
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
    at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:569)
    at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:517)
    ... 54 more

      2024-12-02 18:42:14,199 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application: 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:121)
    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.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:116)
    at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.NoClassDefFoundError: okhttp3/Interceptor
    at io.opentelemetry.exporter.sender.okhttp.internal.OkHttpHttpSenderProvider.createSender(OkHttpHttpSenderProvider.java:43)
    at io.opentelemetry.exporter.internal.http.HttpExporterBuilder.build(HttpExporterBuilder.java:191)
    at io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporterBuilder.build(OtlpHttpMetricExporterBuilder.java:269)
    at io.opentelemetry.exporter.otlp.internal.OtlpMetricExporterProvider.createExporter(OtlpMetricExporterProvider.java:53)
    at io.opentelemetry.sdk.autoconfigure.internal.SpiHelper.lambda$loadConfigurable$0(SpiHelper.java:75)
    at io.opentelemetry.sdk.autoconfigure.internal.NamedSpiManager.tryLoadImplementationForName(NamedSpiManager.java:51)
    at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
    at io.opentelemetry.sdk.autoconfigure.internal.NamedSpiManager.getByName(NamedSpiManager.java:41)
    at io.opentelemetry.sdk.autoconfigure.MetricExporterConfiguration.configureExporter(MetricExporterConfiguration.java:133)
    at io.opentelemetry.sdk.autoconfigure.MetricExporterConfiguration.configureReader(MetricExporterConfiguration.java:53)
    at io.opentelemetry.sdk.autoconfigure.MeterProviderConfiguration.lambda$configureMetricReaders$2(MeterProviderConfiguration.java:92)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1715)...
    ... 11 more
Caused by: java.lang.ClassNotFoundException: okhttp3.Interceptor
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
    at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:569)
    at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:517)
    ... 54 more

How to Reproduce?

  1. Set all signals to disabled at build time:
quarkus.otel.traces.enabled=false
quarkus.otel.metrics.enabled=false
quarkus.otel.logs.enabled=false

1.1. Only the 1st one should be enough to reproduce the condition because the others are false by default.

  1. Build the app, try to start it.

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions