Skip to content

Commit

Permalink
Don't create ActivityContext struct for comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
ngruson committed Dec 21, 2023
1 parent 462287e commit 2aa9fd9
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,10 @@ public void OnStartActivity(Activity activity, object payload)
if (textMapPropagator is not TraceContextPropagator)
{
var ctx = textMapPropagator.Extract(default, request, HttpRequestHeaderValuesGetter);
var activityContext = new ActivityContext(activity.TraceId, activity.ParentSpanId, activity.ActivityTraceFlags, activity.TraceStateString, true);
if (ctx.ActivityContext.IsValid()
&& !((ctx.ActivityContext.TraceId == activityContext.TraceId)
&& (ctx.ActivityContext.SpanId == activityContext.SpanId)
&& (ctx.ActivityContext.TraceState == activityContext.TraceState)))
&& !((ctx.ActivityContext.TraceId == activity.TraceId)
&& (ctx.ActivityContext.SpanId == activity.ParentSpanId)
&& (ctx.ActivityContext.TraceState == activity.TraceStateString)))
{
// Create a new activity with its parent set from the extracted context.
// This makes the new activity as a "sibling" of the activity created by
Expand Down

0 comments on commit 2aa9fd9

Please sign in to comment.