Repository navigation
feat(obs): the job span becomes a child of the request that enqueued it (telemetry P9) - #481
Merged
Merged
Conversation
…it (P9)
`dispatcher.rs` has carried this as a TODO since P3, and it named its own
precondition:
// The §10.2 hop, half-closed: the enqueue side writes this ... Making this
// span a true CHILD of that context needs the OTel context propagator,
// which arrives with the exporter — at which point this field becomes
// `set_parent`.
The exporter arrived in #429, so it does.
`jobs.trace_context` has held the traceparent of the enqueueing request all
along, and the dispatcher recorded it as a span FIELD. A field joins two traces
by log search; it does not make them one trace. Now the context is adopted as
the job span's parent, so a click, the HTTP request it caused, the job, its run,
its eleven stages and every statement they execute are ONE trace — which is the
thing this whole programme is for.
The field stays. CloudWatch Logs has no span tree to walk, so it remains how
the two sides join there.
## Where it lives
`er-obs`, not `er-server`. The propagator needs `opentelemetry_sdk` and
`tracing-opentelemetry` and the control plane has neither, so this keeps the
OTel surface in the one crate that owns it and gives the dispatcher a one-line
call instead of two dependencies.
## Best effort, silently
A job the scheduler enqueued has no request behind it and stays a root, which
is correct and not worth a log line on every claim. A context that will not
parse also leaves it a root — exactly the behaviour before this existed — and
`acceptable_traceparent` has already refused malformed values on the way in. A
job must never fail because its telemetry lineage could not be established.
## The test is a PAIR, and the control is the point
`adopts_parent_context.rs` asserts the exported `trace_id` equals the incoming
one, as its sixteen RAW BYTES, because that is how OTLP encodes it — asserting
on a hex string would pass while the field held something else, which is a
mistake this crate's tests already made once against `otel.status_code`.
The second test exports WITHOUT adopting and asserts the trace id is absent.
Without it the positive test could pass because the bytes appeared somewhere
incidental, and a test that cannot fail for the right reason is not evidence.
Verified by breaking `adopt_traceparent`: the positive test fails with its own
message, the control keeps passing.
`make check` passes.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin
force-pushed
the
bm/telemetry-p9-job-parent
branch
from
November 5, 2026 02:10
2d5a52d to
f06189e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
dispatcher.rshas carried this as a TODO since P3, and it named its own precondition:The exporter arrived in #429, so it does.
jobs.trace_contexthas held the traceparent of the enqueueing request all along, and the dispatcher recorded it as a span field. A field joins two traces by log search; it does not make them one trace. Now the context is adopted as the job span's parent, so a click, the HTTP request it caused, the job, its run, its eleven stages and every statement they execute are one trace — which is the thing this whole programme is for.The field stays: CloudWatch Logs has no span tree to walk, so it remains how the two sides join there.
Where it lives, and why
er-obs, noter-server. The propagator needsopentelemetry_sdkandtracing-opentelemetry, and the control plane has neither — so this keeps the OTel surface in the one crate that owns it and gives the dispatcher a one-line call instead of two dependencies.Best effort, silently
A job the scheduler enqueued has no request behind it and stays a root, which is correct and not worth a log line on every claim. A context that will not parse also leaves it a root — exactly the behaviour before this existed — and
acceptable_traceparenthas already refused malformed values on the way in.A job must never fail because its telemetry lineage could not be established.
The test is a pair, and the control is the point
adopts_parent_context.rsasserts the exportedtrace_idequals the incoming one, as its sixteen raw bytes, because that is how OTLP encodes it. Asserting on a hex string would pass while the field held something else entirely — a mistake this crate's tests already made once againstotel.status_code.The second test exports without adopting and asserts the trace id is absent. Without it the positive test could pass because those bytes appeared somewhere incidental, and a test that cannot fail for the right reason is not evidence.
Verified by breaking
adopt_traceparent: the positive test fails with its own message, the control keeps passing.What remains of P9
Two pieces, deliberately not here:
er-dag'sWorkOrder→exec_task), so a runner Job's spans join the same trace rather than starting fresh. The row is the right carrier — it survives a relaunch, and an${ER_…}env var would triprender_job's unsubstituted-placeholder refusal.queue.waitspan, which needs the OTel tracer directly (with_start_time/with_end_time) becausetracinghas no API for a span that already happened. That gap between enqueue and claim is where per-tenant serialization shows up, and it is invisible today.make checkpasses.🤖 Generated with Claude Code