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

cleanup(pubsub): don't link invalid messages #13649

Merged
merged 1 commit into from
Feb 23, 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 @@ -68,10 +68,13 @@ StatusOr<pubsub::PullResponse> EndPullSpan(
/*sc::kMessagingMessageEnvelopeSize=*/"messaging.message.envelope.size",
static_cast<std::int64_t>(MessageSize(message)));

auto current = opentelemetry::context::RuntimeContext::GetCurrent();
auto context = ExtractTraceContext(message, *propagator);
auto producer_span_context =
opentelemetry::trace::GetSpan(context)->GetContext();
if (producer_span_context.IsSampled() && producer_span_context.IsValid()) {
// If the contexts are equal, the message span was invalid.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self:

I don't think the producer_span_context.IsValid() line checks anything, that's what the check darren is adding will now check.

If the current context is equal to the extracted context, it means that the context was not valid.

if (!(current == context) && producer_span_context.IsSampled() &&
producer_span_context.IsValid()) {
#if OPENTELEMETRY_ABI_VERSION_NO >= 2
span->AddLink(producer_span_context, {});
#else
Expand Down