Skip to content

Opentelemetry: Propegate TraceID and SpanID to steps #1663

@ojkelly

Description

@ojkelly

Is your feature request related to a problem? Please describe.
The new OpenTelemetry (OTEL) experiment is helpful, but it does not make it possible to get the current traceId and spanId.

If we could get access to these, we can then link our OTEL instrumentation inside each step with the trace that exists for the whole job.

Describe the solution you'd like
Extend the existing BUILDKITE_TRACE_CONTEXT found in https://github.com/buildkite/agent/blob/848a053b3131ebced93d829c3215b31bddd19f72/tracetools/propagate.go to each step, when a tracing backend is used.

Describe alternatives you've considered
I've hacked around the codebase to enable access to TraceID and SpanID as individual variables, but the OTEL libraries are all focussed around propagating from a single trace context.

Additional context
This helps with getting a deeper understanding of what's happening over the course of a whole job. And helps with linking telemetry from each step together.

I'm willing to work on a PR up for this, if it's likely to be merged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions