beskow commented on code in PR #22677:
URL: https://github.com/apache/camel/pull/22677#discussion_r3110227156
##########
components/camel-opentelemetry2/src/main/java/org/apache/camel/opentelemetry2/OpenTelemetrySpanAdapter.java:
##########
@@ -24,18 +24,41 @@
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.StatusCode;
import io.opentelemetry.context.Scope;
+import org.apache.camel.Exchange;
+import org.apache.camel.telemetry.SpanStorageManagerExchange;
import org.apache.camel.telemetry.TagConstants;
public class OpenTelemetrySpanAdapter implements
org.apache.camel.telemetry.Span {
private static final String DEFAULT_EVENT_NAME = "log";
static final String BAGGAGE_CAMEL_FLAG = "camelScope";
+ private static final SpanStorageManagerExchange SPAN_STORAGE = new
SpanStorageManagerExchange();
+
private final Span otelSpan;
- private final Baggage baggage;
+ private Baggage baggage;
Review Comment:
I agree it makes sense to keep final state final, to avoid any kind of
tampering. But this is the very essence of the proposed change: The initial
bagage set in the constructor (and hence at route initialization, if I
understand it correctly):
this.baggage = baggage.toBuilder().put(BAGGAGE_CAMEL_FLAG, "true").build();
cannot be final, if a processor in a route should be able to add to that
baggage.
This is precisely the requirement we face: Somewhere in the inbound message
(in a header, or as part of the payload) we need to extract a business-defined
concept (typically a business correlation id) and make it available as baggage.
Since we need to extract it from the inbound message, I seen no other practical
way to implement besides in a processor (which by definition will execute after
the route is started and the initial, currently final baggage is set).
Is there another way?
##########
components/camel-opentelemetry2/src/main/java/org/apache/camel/opentelemetry2/OpenTelemetrySpanAdapter.java:
##########
@@ -24,18 +24,41 @@
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.StatusCode;
import io.opentelemetry.context.Scope;
+import org.apache.camel.Exchange;
+import org.apache.camel.telemetry.SpanStorageManagerExchange;
import org.apache.camel.telemetry.TagConstants;
public class OpenTelemetrySpanAdapter implements
org.apache.camel.telemetry.Span {
private static final String DEFAULT_EVENT_NAME = "log";
static final String BAGGAGE_CAMEL_FLAG = "camelScope";
+ private static final SpanStorageManagerExchange SPAN_STORAGE = new
SpanStorageManagerExchange();
Review Comment:
Understood, I have removed it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]