-
Notifications
You must be signed in to change notification settings - Fork 394
Fix losing original karafka trace after iterating through the messages with distributed_tracing on #4876
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
base: master
Are you sure you want to change the base?
Conversation
if parent_span && span.parent_id != parent_span.id | ||
# add a link from the parent trace to the message span | ||
span_link = Tracing::SpanLink.new(parent_trace_digest) | ||
span.links << span_link | ||
|
||
# add a link from the current trace to the parent span | ||
span_link = Tracing::SpanLink.new(trace.to_digest) | ||
parent_span.links << span_link | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please let me know your thoughts here! I understand that "span links" are not very widely used here in the ruby sdk, but one challenge we have once we continue a trace is co-relating the span with its "original parent". I think span links are a great fit for solving that problem.
Err thanks for the patience, I've asked the team to take a look at this asap :) |
@Drowze I took a first pass and I need to allocate proper time to understand how we best want to present this kind of workflow (span links, directly linking, something else). I have scheduled time to take a good look at this next week. |
Regarding span links: I read https://docs.datadoghq.com/tracing/trace_collection/span_links/ to try to understand their usage. The documentation page says the span links are for relationships other than parent/child. In this PR they are used for parent/child relationship? What is the actual gain/benefit? |
end | ||
|
||
Tracing.trace(Ext::SPAN_MESSAGE_CONSUME) do |span| | ||
Tracing.trace(Ext::SPAN_MESSAGE_CONSUME, continue_from: trace_digest) do |span, trace| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I am not sure this is correct. Is continue_from
really meant for parent/child relationship?
Looking at this PR again I don't understand the fix. The problem is the parent trace gets reset somehow, therefore I would expect the fix to repair the reset. How is adding links fixing the reset? |
What does this PR do?
On the Karafka integration, when
distributed_tracing
is on, the original trace was lost after iterating through the messages. This PR aims to fix that and also add span links linking the message traces with the parent consumer trace (so it's easier to find each other using the Datadog APM UI).Fixes #4873
Motivation:
Fix and improve the Datadog Karafka support.
Change log entry
Additional Notes:
How to test the change?
See #4873 for a full testing snippet.