{"record":{"id":"b6ff4fb74d524e0b","repo":"quarkusio/quarkus","slug":"opentelemetry-instance-not-found","errorCode":null,"errorMessage":"OpenTelemetry instance not found","messagePattern":"OpenTelemetry instance not found","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/micrometer-opentelemetry/runtime/src/main/java/io/quarkus/micrometer/opentelemetry/runtime/MicrometerOtelBridgeRecorder.java","lineNumber":28,"sourceCode":"import io.micrometer.core.instrument.MeterRegistry;\nimport io.micrometer.core.instrument.Metrics;\nimport io.opentelemetry.api.OpenTelemetry;\nimport io.opentelemetry.instrumentation.micrometer.v1_5.OpenTelemetryMeterRegistry;\nimport io.quarkus.arc.SyntheticCreationalContext;\nimport io.quarkus.runtime.annotations.Recorder;\n\n@Recorder\npublic class MicrometerOtelBridgeRecorder {\n\n    public Function<SyntheticCreationalContext<MeterRegistry>, MeterRegistry> createBridge() {\n        return new Function<>() {\n            @Override\n            public MeterRegistry apply(SyntheticCreationalContext<MeterRegistry> context) {\n                Instance<OpenTelemetry> openTelemetry = context.getInjectedReference(new TypeLiteral<>() {\n                });\n\n                if (openTelemetry.isUnsatisfied()) {\n                    throw new IllegalStateException(\"OpenTelemetry instance not found\");\n                }\n\n                MeterRegistry meterRegistry = OpenTelemetryMeterRegistry.builder(openTelemetry.get())\n                        .setPrometheusMode(false)\n                        .setMicrometerHistogramGaugesEnabled(true)\n                        // The time unit should be seconds according to the OpenTelemetry documentation\n                        .setBaseTimeUnit(TimeUnit.SECONDS)\n                        .setClock(Clock.SYSTEM)\n                        .build();\n                Metrics.addRegistry(meterRegistry);\n                return meterRegistry;\n            }\n        };\n    }\n}\n","sourceCodeStart":10,"sourceCodeEnd":44,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/micrometer-opentelemetry/runtime/src/main/java/io/quarkus/micrometer/opentelemetry/runtime/MicrometerOtelBridgeRecorder.java#L10-L44","documentation":"The Micrometer-OpenTelemetry bridge creates the MeterRegistry from an OpenTelemetry instance obtained via injected reference. If no OpenTelemetry bean is available in the container (unsatisfied dependency), the bridge cannot function and throws IllegalStateException. This indicates the OTel extension/bean is missing at runtime.","triggerScenarios":"quarkus-micrometer-opentelemetry is on the classpath and a MeterRegistry is created, but no OpenTelemetry bean exists — e.g. the quarkus-opentelemetry extension is absent or its runtime bean was not produced.","commonSituations":"Adding the micrometer-opentelemetry dependency without adding quarkus-opentelemetry; disabling the OTel extension via build properties; custom builds where the OpenTelemetry producer was removed or made conditional.","solutions":["Add the quarkus-opentelemetry extension (io.quarkus:quarkus-opentelemetry) to the application","Verify the OTel SDK is active — check quarkus.otel.* configuration so the OpenTelemetry bean is produced","Check the build for exclusions/conditions that suppress the OpenTelemetry bean production","If bridging is optional, remove quarkus-micrometer-opentelemetry so Micrometer uses default registries"],"exampleFix":"// before (pom.xml): only micrometer-opentelemetry\n<dependency><groupId>io.quarkus</groupId><artifactId>quarkus-micrometer-opentelemetry</artifactId></dependency>\n// after: also add the OTel extension\n<dependency><groupId>io.quarkus</groupId><artifactId>quarkus-opentelemetry</artifactId></dependency>","handlingStrategy":"try-catch","validationCode":"// in a synthetic bean / extension check\nboolean otelPresent = Arc.container() != null\n    && Arc.container().instance(OpenTelemetry.class).isAvailable();\nif (!otelPresent) { throw new IllegalStateException(\"Add io.quarkus:quarkus-opentelemetry\"); }","typeGuard":"null","tryCatchPattern":"try {\n    MeterRegistry registry = recorder.apply(context);\n} catch (IllegalStateException e) {\n    throw new IllegalStateException(\"Micrometer-OTel bridge requires an OpenTelemetry bean; add the quarkus-opentelemetry extension\", e);\n}","preventionTips":["Always pair quarkus-micrometer-opentelemetry with quarkus-opentelemetry","Verify OTel bean availability in integration tests early in the build","Avoid custom build steps that suppress the default OpenTelemetry producer"],"tags":["opentelemetry","micrometer","dependency-injection","missing-bean"],"backgroundTag":"missing-bean-dependency","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}