Enable Otel TRACEPARENT propagation to spawned processes/shells
#1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the Buildkite agent only enables propagation to spawned processes for OpenTracing (Datadog) and not for OpenTelemetry. We have a need for the spawned process, which uses Otel, to access the trace parent of the span that did the spawning. All that's currently available is the
BUILDKITE_TRACING_TRACEPARENTenv variable which is the span that was triggered by the Buildkite remote serve/pipeline product forbuildkite.jobrather than any span generated by the actual agent itself.With this PR we're going to leverage the W3C standard and set the
TRACEPARENTenv variable when we shell out to a process and the span used will be the span that's open in the agent.We anticipate this to be reasonably short-lived as a change because it's filling the gap of buildkite#1663 for our own purposes. Buildkite hope to prioritise this in their agent at some point in the future so keep an eye on that issue for when this patch may no longer be needed.