Skip to content

Commit 0933a13

Browse files
committed
open-telemetry: document how to trace camel routes fix #3933
1 parent 00ec01d commit 0933a13

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

docs/asciidoc/modules/opentelemetry.adoc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,56 @@ Additional integrations are provided via `OtelExtension` implementations. Many o
168168
**Lifecycle & Lazy Initialization:** Although `OtelModule` must be installed at the very beginning of your application, its extensions are **lazily initialized**. They defer their execution to the application's `onStarting` lifecycle hook. This ensures that all target components provided by other modules (like database connection pools or background schedulers) are fully configured and available in the service registry before the OpenTelemetry extensions attempt to instrument them.
169169
====
170170

171+
==== Apache Camel
172+
173+
Seamlessly integrates OpenTelemetry with Apache Camel. By combining Camel's native OpenTelemetry component with Jooby's `OtelModule`, it automatically instruments your Camel routes. It ensures distributed trace contexts remain unbroken whether you are triggering routes synchronously from Jooby HTTP endpoints or consuming messages asynchronously from background brokers (like Kafka, ActiveMQ, or RabbitMQ).
174+
175+
Required dependency:
176+
[dependency, groupId="org.apache.camel", artifactId="camel-opentelemetry2", version="${camel.version}"]
177+
.
178+
179+
To activate the instrumentation, you must enable it in your application configuration:
180+
181+
.application.conf
182+
[source, properties]
183+
----
184+
camel.opentelemetry2.enabled = true
185+
----
186+
187+
.Camel Integration
188+
[source, java, role = "primary"]
189+
----
190+
import io.jooby.camel.CamelModule;
191+
import io.jooby.opentelemetry.OtelModule;
192+
193+
{
194+
install(new OtelModule()); <1>
195+
196+
install(new CamelModule(new MyCamelRoutes())); <2>
197+
}
198+
----
199+
200+
.Kotlin
201+
[source, kt, role="secondary"]
202+
----
203+
import io.jooby.camel.CamelModule
204+
import io.jooby.opentelemetry.OtelModule
205+
206+
{
207+
install(OtelModule()) <1>
208+
209+
install(CamelModule(MyCamelRoutes())) <2>
210+
}
211+
----
212+
213+
<1> Initializes the global OpenTelemetry SDK. It must be installed at the very beginning of your application setup.
214+
<2> Registers the Camel module. Because `camel.opentelemetry2.enabled` is set to true, Camel will automatically detect the active tracer provided by `OtelModule` and weave it into your route lifecycle.
215+
216+
[NOTE]
217+
====
218+
Installation order is critical. `OtelModule` must be installed **before** `CamelModule` so that the global OpenTelemetry SDK is fully initialized before Camel attempts to attach its route interceptors.
219+
====
220+
171221
==== db-scheduler
172222

173223
Automatically instruments the `db-scheduler` library. It tracks background task executions, measuring execution durations and recording successes and failures.

0 commit comments

Comments
 (0)