Este conteúdo não está disponível no idioma selecionado.

Chapter 59. OpenTelemetry


Distributed tracing using OpenTelemetry

59.1. What’s inside

Please refer to the above link for usage and configuration details.

59.2. Maven coordinates

Create a new project with this extension on code.quarkus.redhat.com

Or add the coordinates to your existing project:

<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-opentelemetry</artifactId>
</dependency>
Copy to Clipboard Toggle word wrap

59.3. Usage

The extension automatically creates a Camel OpenTelemetryTracer and binds it to the Camel registry.

In order to send the captured traces to a tracing system, you need to configure some properties within application.properties like those below.

# Identifier for the origin of spans created by the application
quarkus.application.name=my-camel-application

# For OTLP
quarkus.opentelemetry.tracer.exporter.otlp.endpoint=http://localhost:4317

# For Jaeger
quarkus.opentelemetry.tracer.exporter.jaeger.endpoint=http://localhost:14250
Copy to Clipboard Toggle word wrap

Note that you must add a dependency to the OpenTelemetry exporter that you want to work with.

At present, Quarkus has support for Jaeger and the OpenTelemetry Protocol Specification (OTLP).

For Jaeger:

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-opentelemetry-exporter-jaeger</artifactId>
</dependency>
Copy to Clipboard Toggle word wrap

For OTLP:

<dependency>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-opentelemetry-exporter-otlp</artifactId>
</dependency>
Copy to Clipboard Toggle word wrap

Refer to the Quarkus OpenTelemetry guide for a full list of configuration options.

Route endpoints can be excluded from tracing by configuring a property named quarkus.camel.opentelemetry.exclude-patterns in application.properties. For example:

# Exclude all direct & netty-http endpoints from tracing
quarkus.camel.opentelemetry.exclude-patterns=direct:*,netty-http:*
Copy to Clipboard Toggle word wrap

59.3.1. Tracing CDI bean method execution

When instrumenting the execution of CDI bean methods from Camel routes, you should annotate such methods with io.opentelemetry.extension.annotations.WithSpan. Methods annotated with @WithSpan will create a new Span and establish any required relationships with the current Trace context.

For example, to instrument a CDI bean from a Camel route, first ensure the appropriate methods are annotated with @WithTrace.

@ApplicationScoped
@Named("myBean")
public class MyBean {
    @WithSpan
    public String greet() {
        return "Hello World!";
    }
}
Copy to Clipboard Toggle word wrap

Next, use the bean in your Camel route.

Important

To ensure that the sequence of recorded spans is correct, you must use the full to("bean:") endpoint URI and not the shortened .bean() EIP DSL method.

public class MyRoutes extends RouteBuilder {
    @Override
    public void configure() throws Exception {
        from("direct:executeBean")
                .to("bean:myBean?method=greet");
    }
}
Copy to Clipboard Toggle word wrap

There is more information about CDI instrumentation in the Quarkus OpenTelemetry guide.

59.4. Additional Camel Quarkus configuration

Expand
Configuration propertyTypeDefault

lock quarkus.camel.opentelemetry.encoding

Sets whether header names need to be encoded. Can be useful in situations where OpenTelemetry propagators potentially set header name values in formats that are not compatible with the target system. E.g for JMS where the specification mandates header names are valid Java identifiers.

boolean

false

lock quarkus.camel.opentelemetry.exclude-patterns

Sets whether to disable tracing for endpoint URIs that match the given patterns. The pattern can take the following forms:

1. An exact match on the endpoint URI. E.g platform-http:/some/path

2. A wildcard match. E.g platform-http:*

3. A regular expression matching the endpoint URI. E.g platform-http:/prefix/.*

string

 

lock Configuration property fixed at build time. All other configuration properties are overridable at runtime.

Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat