Hi Mikael,
we discussed about it some times ago in the dev mailing list. The feature
is deprecated as it is not working correctly due to the specific way each
telemetry is implemented [1]. However you can always use the specific
opentelemetry way to do that [2].

Cheers,
Pasquale.

[1]
https://camel.apache.org/components/next/others/tracing.html#_mdc_logging
[2]
https://camel.apache.org/components/next/others/opentelemetry.html#_mdc_logging

On Wed, Feb 5, 2025 at 2:11 PM Mikael Koskinen <mijap...@gmail.com> wrote:

> Hi,
>
> Enabling OpenTelemetry in Camel Main is straightforward, thanks to the good
> documentation on Camel JBang's page. I get telemetry, metrics and logs
> moving.
>
> But I have a problem with the logs that the OTEL Collector receives. The
> logs are missing trace and span ids. I have enabled mdc logging in
> application.properties:
>
>
>
> *camel.main.useMdcLogging*
> And I can see the span_id and trace_id when json logging is enabled:
>
>
> {"@timestamp":"2025-02-05T12:06:39.095Z","ecs.version":"1.2.0","log.level":"INFO","message":"Hello
> This message comes from the
> application.properties","process.thread.name":"Camel
> (camel-1) thread #4 -
>
> timer://yaml","log.logger":"integration.camel.yaml:8","camel.contextId":"otel-test","camel.exchangeId":"FBC40ADA8D08EAB-0000000000000002","camel.messageId":"FBC40ADA8D08EAB-0000000000000002","camel.routeId":"route1","span_id":"6a0dbd5a9773d891","trace_id":"b3499efd42a7ec8971ff04cc19f08d3a"}
>
> But on the OTEL Collector side span_id and trace_id are both empty.
>
> I enabled OTEL Java Agent's debugging and it displays the following:
>
> [otel.javaagent 2025-02-05 14:06:39:096 +0200] [Camel (camel-1) thread #4 -
> timer://yaml] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter -
> 'timer' : b3499efd42a7ec8971ff04cc19f08d3a 6a0dbd5a9773d891 SERVER [tracer:
> camel:] AttributesMap{data={url.path=yaml, component=camel-timer,
> url.query=period=3500, thread.id=39, camel.uri=timer://yaml?period=3500,
> thread.name=Camel (camel-1) thread #4 - timer://yaml, url.scheme=timer},
> capacity=128, totalAddedValues=7}
>
> I'm not sure if that is correct. Should the AttributesMap contain the
> span_id and trace_id? I'm using the Camel LTS version.
>
> I would really appreciate it if anyone has any ideas on how to get trace_id
> and span_id correctly to work for logs.
>
> Best regards,
> Mikael
>

Reply via email to