Skip to content

Commit

Permalink
correctly set parent activity as remote (#6585) (#6588)
Browse files Browse the repository at this point in the history
  • Loading branch information
timbussmann authored Nov 8, 2022
1 parent 89fd67b commit cfab2b5
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ public Activity StartIncomingActivity(MessageContext context)
}
else if (context.Headers.TryGetValue(Headers.DiagnosticsTraceParent, out var sendSpanId) && ActivityContext.TryParse(sendSpanId, null, out var sendSpanContext)) // otherwise directly create child from logical send
{
activity = ActivitySources.Main.CreateActivity(name: ActivityNames.IncomingMessageActivityName, ActivityKind.Consumer, sendSpanContext);
// TryParse doesn't have an overload that supports changing the isRemote setting yet
// This can be removed with .NET 7, see https://github.com/dotnet/runtime/issues/42575
var remoteParentActivityContext = new ActivityContext(sendSpanContext.TraceId, sendSpanContext.SpanId, sendSpanContext.TraceFlags, sendSpanContext.TraceState, isRemote: true);
activity = ActivitySources.Main.CreateActivity(name: ActivityNames.IncomingMessageActivityName, ActivityKind.Consumer, remoteParentActivityContext);
}
else // otherwise start new trace
{
Expand Down

0 comments on commit cfab2b5

Please sign in to comment.