[
https://issues.apache.org/jira/browse/CAMEL-23564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18082561#comment-18082561
]
Federico Mariani commented on CAMEL-23564:
------------------------------------------
Hi [~magnuse]
Thanks for reporting this and for the detailed reproducer.
I confirm that baggage set via _OTEL_BAGGAGE__ headers is not visible in
Baggage.current() inside custom .process().
I do not think this is a bug, but this is something not mentioned in the
documentation (that I am going to update), in order to retrieve _OTEL_BAGGAGE__
headers in custom processor you should set
{code:java}
camel.opentelemetry2.traceProcessors=true{code}
this way each custom processor gets its own span, which reads the exchange
headers at creation time and picks up the {_}OTEL_BAGGAGE_*.
{_}You can try it in the reproducer, just add
{code:java}
camel:
opentelemetry2:
traceProcessors: true{code}
in the _application.yml_ and the test is successful
> Baggage customization doesn't seem to work
> ------------------------------------------
>
> Key: CAMEL-23564
> URL: https://issues.apache.org/jira/browse/CAMEL-23564
> Project: Camel
> Issue Type: Bug
> Components: camel-opentelemetry
> Affects Versions: 4.20.0
> Reporter: Magnus Ekstrand
> Assignee: Federico Mariani
> Priority: Major
> Attachments: otel-baggage-sample.zip
>
>
> We are trying to use the Baggage Customization feature introduced in Camel
> 4.20, but can't seem to get it to work.
>
> We use the OTEL Agent with MDC Instrumentation to have trace_id, span_id and
> baggage included in the logs. It works as
> expected for our vanilla Spring Boot applications.
>
> For our Camel routes, only externally provided baggage (i.e. an incoming
> baggage header) shows up in the logs, but baggage
> entries added using a Camel OTEL_BAGGAGE_ header as described in
> [https://camel.apache.org/components/next/others/opentelemetry2.html#_baggage_customization]
> does not show up in the logs.
>
> Our route looks like this:
>
> {code:java}
> from(..)
> .setHeader("OTEL_BAGGAGE_BusinessReference", header(REFERENCE_HEADER))
> .process(logReceived) // <- logging happens in here
> .process(transformer) // <- logging happens in here
> .to(..)
> .process(logSent); // <- logging happens in here
> {code}
>
> An incoming baggage entry is included in the logs, but not the
> BusinessReference entry.
>
> What am I doing wrong?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)