Repository navigation
fix(jobs): report byte counts for returned observation output - #1332
Merged
yyjeqhc merged 1 commit intoOct 28, 2026
Merged
Conversation
Job observations already feed a returned-byte metric, but the bounded output producer never populated stdout_returned_bytes or stderr_returned_bytes, so the metric silently fell back to zero. Report the UTF-8 byte length of the stdout and stderr fragments actually returned after output limiting. The Job and observation lifecycle are unchanged.
yyjeqhc
approved these changes
Oct 28, 2026
yyjeqhc
left a comment
Owner
There was a problem hiding this comment.
Reviewed the scoped implementation and regression coverage against its source baseline; CI and diff checks pass. No blocking issue identified.
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.
Problem
observe_jobsalready aggregates a returned-byte metric from each successful observation'soutput.stdout_returned_bytesandoutput.stderr_returned_bytes(src/tool_runtime/observe_jobs.rs), but the bounded observation producer insrc/tool_runtime/jobs.rsnever populated either field. Both lookups therefore fell back to zero, sojob_observation_items_totalreportedreturned_bytes = 0for every batch regardless of how much stdout/stderr was actually returned to the caller.Change
The producer now reports the UTF-8 byte length of the stdout and stderr fragments it actually returns after output limiting (
stdout.len(),stderr.len()). This is the returned fragment, not the Job's cumulative log volume and not the serialized JSON size. Job lifecycle, wait/update semantics, reconciliation and recovery are untouched, and no new statistics path is added: the existing consumer is simply given the facts it already expects.Compatibility
additionalProperties: true), so no schema tightening or migration is involved.Validation
Test:
observe_jobs_metrics_sum_utf8_bytes_of_returned_producer_outputinsrc/tool_runtime/tests/observe_jobs.rs. It drives the real producer (a test runtime with runner registry Job updates) and the real consumer (a recordingRuntimeMetricssink), covering stdout-only, stderr-only, both, empty output, and one failed item in the same batch:tail_lines = 1the reported bytes describe only the returned truncated fragment.Commands (Linux x86_64, Rust 1.99.1):
Not run here: Windows/macOS/ARM64 lanes (no environment available).