Skip to content

Conversation

linqueta
Copy link

As discussed on #508, Oban.JobHandler seems not to be setting the right span, ignoring the parent, causing a break in the traces for a flow. This fix allows the parent span to be included in the traces.

In case a parent span doesn't exist, it'll have the value :undefined, exactly what has been set by default in the current code.

Copy link

linux-foundation-easycla bot commented May 12, 2025

CLA Signed


The committers listed above are authorized under a signed CLA.

parent = OpenTelemetry.Tracer.current_span_ctx()
links = if parent == :undefined, do: [], else: [OpenTelemetry.link(parent)]
OpenTelemetry.Tracer.set_current_span(:undefined)
OpenTelemetry.Tracer.set_current_span(parent)
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC, I did it because we already create an Opentelemetry link. If we also set the parent, then we have both a link and a direct relationship. Can you link from the opentelemetry docs that this should not be a link?

Copy link
Author

Choose a reason for hiding this comment

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

I understand @indrekj , I'm not sure if it shouldn't be a link or not, I just evaluated how it was logged at Datadog, and I missed the parent in the whole tree of traces.
So, I don't have a solid argument to say if it should or not. In case not we can close the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants