Skip to content

Incorrect explanation of propagating OTel context for queue jobs #43

@Longwelwind

Description

@Longwelwind

Hello,

The current section about propagating OTel context for queue jobs describes a mechanism to transmit the context from the producing context to the consuming context, but this is not the correct way to describe the relationship between the 2 otel traces.

injectTraceContext and extractTraceContext should be used to propagate context for synchronous, parent-child traces. For example, when a service A makes a request to a service B, then it makes sense for the trace in service B to a child of the trace in service A, since service A waits for the request to finish before continuing its execution.

But since the execution of a queued job could happen well after the end of the producing trace, Span Link are more appropriate for this use-case.

The Datadog doc describes the same mechanism: https://docs.datadoghq.com/tracing/trace_collection/span_links/#common-use-cases

If I get an approval from a maintainer, I can make a PR to change this section of the doc to use links instead

It might be a good idea to add a helper method in the adonisjs/otel package to make it easier to link 2 spans together. I'll see if I find the time to add this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions