This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new b7b9d796355 CAMEL-17902: Align MDC logging keys for traceId and spanId 
to be aligned with OpenTelemetry standard.
b7b9d796355 is described below

commit b7b9d796355aae3ac1e895baf36b80d5c9403dc8
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed May 11 21:03:04 2022 +0200

    CAMEL-17902: Align MDC logging keys for traceId and spanId to be aligned 
with OpenTelemetry standard.
---
 .../src/main/docs/opentelemetry.adoc                   |  4 +++-
 .../camel-opentracing/src/main/docs/opentracing.adoc   |  2 +-
 .../org/apache/camel/opentracing/MDCSupportTest.java   |  4 ++--
 .../org/apache/camel/tracing/ActiveSpanManager.java    |  4 ++--
 .../ROOT/pages/camel-3x-upgrade-guide-3_17.adoc        | 18 +++++++++++++-----
 5 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/components/camel-opentelemetry/src/main/docs/opentelemetry.adoc 
b/components/camel-opentelemetry/src/main/docs/opentelemetry.adoc
index a4a332b36c0..8a44f17135c 100644
--- a/components/camel-opentelemetry/src/main/docs/opentelemetry.adoc
+++ b/components/camel-opentelemetry/src/main/docs/opentelemetry.adoc
@@ -61,6 +61,7 @@ The `OpenTelemetryTracer` will be implicitly obtained from 
the camel context's `
 a `OpenTelemetryTracer` bean has been defined by the application.
 
 == Java Agent
+
 Download the 
https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/[latest
 version].
 
 This package includes the instrumentation agent as well as instrumentations 
for all supported libraries and all available data exporters.
@@ -84,4 +85,5 @@ java -javaagent:path/to/opentelemetry-javaagent.jar \
 include::spring-boot:partial$starter.adoc[]
 
 == MDC Logging
-When MDC Logging is enabled for the active Camel context the Trace ID and Span 
ID will be added and removed from the MDC for each route, the keys are 
`traceId` and `spanId`, respectively.
+
+When MDC Logging is enabled for the active Camel context the Trace ID and Span 
ID will be added and removed from the MDC for each route, the keys are 
`trace_id` and `span_id`, respectively.
diff --git a/components/camel-opentracing/src/main/docs/opentracing.adoc 
b/components/camel-opentracing/src/main/docs/opentracing.adoc
index f7a17c13455..cdd75459263 100644
--- a/components/camel-opentracing/src/main/docs/opentracing.adoc
+++ b/components/camel-opentracing/src/main/docs/opentracing.adoc
@@ -140,6 +140,6 @@ and the resulting message would contain:
 * Header "baggage-header" of value "foo"
 
 == MDC Logging
-When MDC Logging is enabled for the active Camel context the Trace ID and Span 
ID will be added and removed from the MDC for each route or processor 
(depending on the tracing strategy configured), the keys are `traceId` and 
`spanId`, respectively.
+When MDC Logging is enabled for the active Camel context the Trace ID and Span 
ID will be added and removed from the MDC for each route or processor 
(depending on the tracing strategy configured), the keys are `trace_id` and 
`span_id`, respectively.
 
 If the `OpenTracingTracingStrategy` is enabled the span ID will be the one for 
the current processor that logs an entry, otherwise it will be the one for the 
current route.
diff --git 
a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/MDCSupportTest.java
 
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/MDCSupportTest.java
index 5e7bd534c04..e8891c8a448 100644
--- 
a/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/MDCSupportTest.java
+++ 
b/components/camel-opentracing/src/test/java/org/apache/camel/opentracing/MDCSupportTest.java
@@ -62,8 +62,8 @@ public class MDCSupportTest extends 
CamelOpenTracingTestSupport {
                 from("seda:a").routeId("a")
                         .process(new Processor() {
                             public void process(Exchange exchange) {
-                                assertNotNull(MDC.get("traceId"));
-                                assertNotNull(MDC.get("spanId"));
+                                assertNotNull(MDC.get("trace_id"));
+                                assertNotNull(MDC.get("span_id"));
                             }
                         });
             }
diff --git 
a/components/camel-tracing/src/main/java/org/apache/camel/tracing/ActiveSpanManager.java
 
b/components/camel-tracing/src/main/java/org/apache/camel/tracing/ActiveSpanManager.java
index 5c86279bc23..15e3b9a7fdf 100644
--- 
a/components/camel-tracing/src/main/java/org/apache/camel/tracing/ActiveSpanManager.java
+++ 
b/components/camel-tracing/src/main/java/org/apache/camel/tracing/ActiveSpanManager.java
@@ -24,8 +24,8 @@ import org.slf4j.MDC;
  */
 public final class ActiveSpanManager {
 
-    public static final String MDC_TRACE_ID = "traceId";
-    public static final String MDC_SPAN_ID = "spanId";
+    public static final String MDC_TRACE_ID = "trace_id";
+    public static final String MDC_SPAN_ID = "span_id";
     private static final String ACTIVE_SPAN_PROPERTY = 
"OpenTracing.activeSpan";
 
     private ActiveSpanManager() {
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_17.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_17.adoc
index d166822e483..f22e7c35e3a 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_17.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_17.adoc
@@ -173,25 +173,33 @@ Asynchronous, Synchronous or NO-OP commit policies from 
the former `autoCommitOn
 
 The deprecated constructors for the kafkaManualCommitFactory have been 
removed. The constructor should now receive the following parameters:
 
-```
+[source,java]
+----
 CamelExchangePayload camelExchangePayload, KafkaRecordPayload 
kafkaRecordPayload, CommitManager commitManager
-```
-
+----
 
 === camel-platform-http-vertx
 
 The configuration for body handler file uploads has changed from `true` to 
`false`.
 The configuration can be enabled via the 
`VertxPlatformHttpServerConfiguration` class.
 
+=== camel-opentracing / camel-opentelemetry
+
+We aligned the MDC keys with OpenTelemetry, so they are changed from:
+
+- `traceId` -> `trace_id`
+- `spanId` -> `span_id`
+
 === camel-atom
 
 This component was refactored to support the Resume API v2. As such, the 
options `filter` and `lastUpdate` where removed.
 
-```
+[source,java]
+----
 from("atom:file:src/test/data/feed.atom?splitEntries=true&delay=500")
     .resumable().resumeStrategy(new UpdatedDateFilter(new Date()))
     .to("mock:result");
-```
+----
 
 More complex filters can be implemented by extending the `UpdatedDateFilter` 
or by implementing a new `EntryFilter` resume strategy.
 

Reply via email to