Add camel-quarkus-micrometer-observability extension with native support#8879
Add camel-quarkus-micrometer-observability extension with native support#8879JinyuChen97 wants to merge 1 commit into
Conversation
1abed60 to
1ce580c
Compare
|
|
||
| This extension is fully supported in native mode. | ||
|
|
||
| The extension registers `io.micrometer.tracing.test.simple.SimpleTraceContext` for runtime |
There was a problem hiding this comment.
nitpick: I think that it is not necessary to list all configuration here. Having the extension placed in extensions and not extensions-jvm makes clear that native is suppoorted. Also when anybody adds something to configuration, the doc will be out-of-date
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.camel.quarkus</groupId> | ||
| <artifactId>camel-quarkus-micrometer-observability</artifactId> |
There was a problem hiding this comment.
idea: Because there are 2 micrometer-observabilty components in Camel (https://camel.apache.org/components/4.18.x/others/micrometer-observability.html and https://camel.apache.org/components/4.18.x/others/micrometer-observability.html), should we use the number '2' in the name of CQ extension to reflect which one of the components we are extending?
There was a problem hiding this comment.
there is only one micrometer-observability component in camel upstream, I think i need to follow the same and no need to add '2'?
There was a problem hiding this comment.
If I read correctly, there are:
Micrometer Observabilityprovided bycamel-observationmaven module with doc page https://camel.apache.org/components/4.18.x/others/observation.htmlMicrometer Observability 2provided bycamel-micrometer-observabilitymaven module with doc page https://camel.apache.org/components/4.18.x/others/micrometer-observability.html
So I guess we should use camel-quarkus-micrometer-observability as the name of the artifact id but maybe mention the number 2 in the doc page
There was a problem hiding this comment.
noticed that the name is mentioning the number 2 https://github.com/apache/camel-quarkus/pull/8879/changes#diff-fe415796d03d04abe70a35bf7672d65cea6b509838d0ec238b2987804446724eR11
| @@ -0,0 +1,9 @@ | |||
| This extension is fully supported in native mode. | |||
There was a problem hiding this comment.
Same as before, we probably don't need to document this.
|
|
||
| For Brave/Zipkin, add `micrometer-tracing-bridge-brave` instead and configure the reporter of your choice. | ||
|
|
||
| === Filtering endpoints |
There was a problem hiding this comment.
Probably don't needed to be mentioned, as it is part of the camel doc. (this comment can be applied on more parts of this page)
There was a problem hiding this comment.
I have reword the usage.adoc, please check.
|
|
||
| @BuildStep | ||
| RuntimeInitializedClassBuildItem runtimeInitializedClasses() { | ||
| return new RuntimeInitializedClassBuildItem("io.micrometer.tracing.test.simple.SimpleTraceContext"); |
There was a problem hiding this comment.
This class is from micrometer-tracing-test, there it is not needed to register it, if the test dependency is not present. Something like
if
(index.getIndex().getClassByName("io.micrometer.tracing.test.simple.SimpleTraceContext") !=
null) {
runtimeInit.produce(new RuntimeInitializedClassBuildItem(
"io.micrometer.tracing.test.simple.SimpleTraceContext"));
}
would be better (or different way of condition..
There was a problem hiding this comment.
oh yeah, there is no need to register it only for test purpose, I have move this to application.properties in integration test for test only.
1ce580c to
20ffcc8
Compare
apupier
left a comment
There was a problem hiding this comment.
Would be worthy to wait for someone else approval as I'm not very comfortable on Observability topic
|
|
||
| # Configuration properties wired by MicrometerObservabilityTracerProducer — verified by testConfigPropertiesAreWired | ||
| quarkus.camel.micrometer-observability.exclude-patterns = direct:excluded | ||
| quarkus.camel.micrometer-observability.include-patterns = direct:traced,direct:excluded |
There was a problem hiding this comment.
Why direct:excluded is also part of the include-patterns? is it to test that the exclude patterns has an higher priority?
There was a problem hiding this comment.
sorry for causing misunderstanding, this is only for testing if quarkus.camel.micrometer-observability.include-patterns can be captured by registered CDI bean CamelMicrometerObservabilityConfig to MicrometerObservabilityTracerProducer. I will remove this, not necessary to be here.
20ffcc8 to
f9443fb
Compare
jamesnetherton
left a comment
There was a problem hiding this comment.
The main concern I have is with how the MicrometerObservabilityTracerProducer wires up the Micrometer Tracer and Propagator. The current implementation optionally injects them as CDI beans:
@Inject
Instance<Tracer> tracerInstance;
@Inject
Instance<Propagator> propagatorInstance;The problem is that no Quarkus extension currently produces Micrometer Tracer or Propagator CDI beans. So in practice, tracerInstance.isResolvable() will always be false, and the producer falls through to letting Camel's initTracer() handle it — which defaults to Tracer.NOOP and Propagator.NOOP with warning logs. The extension would appear to work but silently produce no traces.
I actually experimented with this extension some time back. The approach I took is to explicitly bridge from the Quarkus-provided OpenTelemetry bean to Micrometer using quarkus-micrometer-opentelemetry (note this currently has preview status) & micrometer-tracing-bridge-otel:
@Inject
OpenTelemetry openTelemetry;
// In the producer method:
Tracer otelTracer = openTelemetry.getTracer("camel");
OtelCurrentTraceContext currentTraceContext = new OtelCurrentTraceContext();
OtelTracer micrometerTracer = new OtelTracer(otelTracer, currentTraceContext, event -> {},
new OtelBaggageManager(currentTraceContext, List.of(), List.of()));
OtelPropagator micrometerPropagator = new OtelPropagator(openTelemetry.getPropagators(), otelTracer);
tracer.setTracer(micrometerTracer);
tracer.setPropagator(micrometerPropagator);This ensures Camel's Micrometer spans are correctly bridged into the same OTel trace context that Quarkus and Vert.x use, so parent-child span relationships work across the full stack.
That way you don't burden the user with having to produce a bunch of CDI beans (which I think is what MicrometerObservabilityConfiguration is doing in the tests).
A couple of other things worth considering:
- SDK disable check: The opentelemetry2 extension checks
oTelRuntimeConfig.sdkDisabled()and returnsnullwhen tracing is disabled. This extension should probably do the same for consistency. - Test fidelity: Using opentelemetry-sdk-testing's
InMemorySpanExporterinstead of micrometer-tracing-test'sSimpleTracerwould validate the full pipeline (Camel → Micrometer bridge → OTel SDK → exporter), proving that spans actually reach OTel rather than only exercising the Micrometer layer.
Adds a new Quarkus extension for camel-micrometer-observability, bridging Camel's telemetry SPI to Micrometer Tracing via the OTel bridge. Extension (runtime): - MicrometerObservabilityTracerProducer: CDI @DefaultBean producer that bridges from the Quarkus-provided OpenTelemetry bean to Micrometer Tracing by constructing OtelTracer, OtelPropagator and ObservationRegistry. - CamelMicrometerObservabilityConfig: five Quarkus config properties under quarkus.camel.micrometer-observability. - Runtime dependencies: quarkus-opentelemetry, micrometer-tracing-bridge-otel. Extension (deployment): - MicrometerObservabilityProcessor: three BuildSteps — FeatureBuildItem, AdditionalBeanBuildItem (producer unremovable), UnremovableBeanBuildItem (Camel Tracer bean). Integration tests (JVM + Native, 4 tests): - testSpansAreGenerated: verifies the full pipeline Camel → MicrometerObservabilityTracer → OtelTracer bridge → OTel SDK → InMemorySpanExporter. - testExcludePatternsAreApplied: verifies exclude-patterns suppresses spans for matching endpoints. - testConfigPropertiesAreWired: verifies all five config properties are correctly propagated to the live MicrometerObservabilityTracer via CamelMicrometerObservabilityConfig. - testUpstreamW3CTracePropagation: verifies W3C traceparent propagation using the real OTel propagator. Test infrastructure uses InMemorySpanExporter (opentelemetry-sdk-testing) for validating the full OTel pipeline. Co-authored-by: Bob <bob@ibm.com>
f9443fb to
0fd5a0a
Compare
Thanks for your feedback! Considering quarkus-micrometer-opentelemetry is preview status and confirmed camel-micrometer-observability is tracing only(only register tracing observation handlers in camel)so this extension should be no metric export to otel. using quarkus-opentelemetry instead to bridge from the quarkus-opentelemetry bean to micrometer tracing with micrometer-tracing-bridge-otel will be enough. |
Adds a new Quarkus extension for camel-micrometer-observability, bridging Camel's telemetry SPI to Micrometer Tracing via the OTel bridge.
Extension (runtime):
Extension (deployment):
Integration tests (JVM + Native, 4 tests):
Test infrastructure uses InMemorySpanExporter (opentelemetry-sdk-testing) for validating the full OTel pipeline.
Fixes #8885
Co-authored-by: Bob bob@ibm.com