Opentelemetry2

Since Camel 4.11

This module is the implementation of the common camel-telemetry interface based on OpenTelemetry technology. The name used here as camel-opentelemetry2 is done to distinguish on the existing camel-opentelemetry which was based on an older Camel tracing specification. You’re invited to start replacing the older camel-opentelemetry with this one instead as it may become the default component in future version of Camel.

this component has slight differences compared to the camel-openetelemetry and is meant to solve a few inconsistencies identified.

Configuration

The configuration properties for the OpenTelemetry2 tracer are:

Option Default Description

excludePatterns

Sets exclude pattern(s) that will disable tracing for Camel messages that matches the pattern. The content is a Set<String> where the key is a pattern. The pattern uses the rules from Intercept.

traceProcessors

false

Setting this to true will create new OpenTelemetry Spans for each Camel Processors. Use the excludePattern property to filter out Processors

Using with standalone Camel

If you use camel-main as standalone Camel, then you can enable and use OpenTelemetry without Java code.

Add camel-opentelemetry2 component in your POM, and configure in application.properties:

camel.opentelemetry2.enabled = true
# you can configure the other options
# camel.opentelemetry2.traceProcessors = true

When starting the application, you may need to configure a few OpenTelemetry SDK variables, as you can see in te following example:

$ java -Dotel.metrics.exporter=none -Dotel.logs.exporter=none -jar my-app.jar

Java Agent

Your application will require a Java agent in order to get the traces generated by the Camel application and push to the tracing server.

certain runtimes (ie, Quarkus) may provide an inner client which pushes traces to the server. Make sure to read each specific Camel runtime documentation.

Download the latest version.

This package includes the instrumentation agent as well as instrumentation for all supported libraries and all available data exporters. The package provides a completely automatic, out-of-the-box experience. Enable the instrumentation agent using the -javaagent flag to the JVM.

java -javaagent:path/to/opentelemetry-javaagent.jar \
     -Dotel. ... \
     -jar myapp.jar

By default, the OpenTelemetry Java agent uses OTLP exporter configured to send data to OpenTelemetry collector at http://localhost:4318.

Configuration parameters are passed as Java system properties (-D flags) or as environment variables. See the configuration documentation for the full list of configuration items. For example:

java -javaagent:path/to/opentelemetry-javaagent.jar \
     -Dotel.service.name=your-service-name \
     -Dotel.traces.exporter=otlp \
     -jar myapp.jar

Collect OpenTelemetry traces

OpenTelemetry is a tracing protocol which is implemented by several vendors. You can use the Jaeger project which provides an open source all in one tracing application. See details how to run it in Jaeger getting started guide.