Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAMEL-20350: camel-observation - Fix Micrometer should use real null … #12891

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,20 @@ private Observation.Context spanKindToContextOnExtract(
throw new UnsupportedOperationException("You can't extract when sending a message");
case SPAN_KIND_SERVER:
RequestReplyReceiverContext<Object, Message> replyReceiverContext
= new RequestReplyReceiverContext<>((carrier, key) -> String.valueOf(adapter.get(key)));
= new RequestReplyReceiverContext<>((carrier, key) -> {
Object val = adapter.get(key);
return val != null ? val.toString() : null;
});
replyReceiverContext.setResponse(exchange.getMessage());
replyReceiverContext.setCarrier(exchange.getIn());
return replyReceiverContext;
case CONSUMER:
case SPAN_KIND_CLIENT:
ReceiverContext<Message> receiverContext
= new ReceiverContext<>((carrier, key) -> String.valueOf(adapter.get(key)));
= new ReceiverContext<>((carrier, key) -> {
Object val = adapter.get(key);
return val != null ? val.toString() : null;
});
receiverContext.setCarrier(exchange.getIn());
return receiverContext;
default:
Expand Down Expand Up @@ -144,8 +150,10 @@ protected SpanAdapter startSendingEventSpan(
// Because Camel allows to close scopes multiple times
TracingObservationHandler.TracingContext tracingContext
= parentObservation.getContextView().get(TracingObservationHandler.TracingContext.class);
Span parentSpan = tracingContext.getSpan();
scope = tracer.withSpan(parentSpan);
if (tracingContext != null) {
Span parentSpan = tracingContext.getSpan();
scope = tracer.withSpan(parentSpan);
}
}
if (parentObservation != null) {
observation.parentObservation(parentObservation);
Expand Down
Loading