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

Fix span linking for Azure ServiceBus #2474

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -126,9 +126,13 @@ private void OnMessageStart(KeyValuePair<string, object> kv, string action)

_onMessageCurrent = currentSegment switch
{
Span span => span.StartSpanInternal(name, ApiConstants.TypeMessaging, ServiceBus.SubType, action.ToLowerInvariant()),
// NOTE: We explicity set the SpanId here to match the Activity (value of the payload) to ensure that span linking on the
// receiver works as expected. The Azure SDK attaches the diagnostic-id and traceparent to the message automatically.
// On the receiving end, we need to be able to correctly link the consuming span to the producer.

Span span => span.StartSpanInternal(name, ApiConstants.TypeMessaging, ServiceBus.SubType, action.ToLowerInvariant(), id: activity.SpanId.ToString()),
Transaction transaction => transaction.StartSpanInternal(name, ApiConstants.TypeMessaging, ServiceBus.SubType,
action.ToLowerInvariant()),
action.ToLowerInvariant(), id: activity.SpanId.ToString()),
_ => _onMessageCurrent
};
}
Expand Down
Loading