Skip to content

Commit

Permalink
Extended trace context propagation to all instances of `DittoHeadersS…
Browse files Browse the repository at this point in the history
…ettable`.

This covers more messages than `Signal`s.

Signed-off-by: Juergen Fickel <juergen.fickel@bosch.io>
  • Loading branch information
Juergen Fickel committed Oct 21, 2022
1 parent bea541f commit 19abbaa
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.eclipse.ditto.base.model.exceptions.DittoInternalErrorException;
import org.eclipse.ditto.base.model.exceptions.DittoRuntimeException;
import org.eclipse.ditto.base.model.headers.DittoHeaders;
import org.eclipse.ditto.base.model.headers.DittoHeadersSettable;
import org.eclipse.ditto.base.model.json.Jsonifiable;
import org.eclipse.ditto.base.model.signals.Signal;
import org.eclipse.ditto.base.model.signals.commands.Command;
Expand Down Expand Up @@ -159,9 +160,10 @@ private void askTargetActor(final Command<?> command, final List<ThingId> thingI
)
.tag("size", Integer.toString(thingIds.size()))
.start();
if (msgToAsk instanceof Signal<?> signal) {
tracedMsgToAsk =
signal.setDittoHeaders(DittoHeaders.of(startedSpan.propagateContext(signal.getDittoHeaders())));
if (msgToAsk instanceof DittoHeadersSettable<?> dittoHeadersSettable) {
tracedMsgToAsk = dittoHeadersSettable.setDittoHeaders(
DittoHeaders.of(startedSpan.propagateContext(dittoHeadersSettable.getDittoHeaders()))
);
} else {
tracedMsgToAsk = msgToAsk;
}
Expand Down

0 comments on commit 19abbaa

Please sign in to comment.