docs(effect-otel): design the flush-shape counters and batch-size histogram (RIG-3694) - #1224
Draft
rigel-mintaka wants to merge 1 commit into
Draft
rigel-mintaka wants to merge 1 commit into
rigel-mintaka wants to merge 1 commit into
Conversation
…togram (RIG-3694)
Design only; the implementation follows against this frozen record.
RIG-3694 asks whether turn coalescing produces many tiny batches or
saturates the cap. No existing instrument answers it: the twelve metrics in
Decision 2 count losses, retries, and depths, and a raw batch rate is
uninterpretable without knowing WHY each batch flushed.
The filed size/timer/shutdown taxonomy does not survive contact with the
code. The spine has no timed flush: pumpLoop's only idle wait is the wake
latch, the sole Effect.sleep is the priority-retry backoff, and takeBatch
never waits for a fuller batch. A reason="timer" label could never be
incremented, and an inert label is forbidden, so it is excluded.
The code-true taxonomy is four reasons, not three: full (the cap closed the
batch), drain (teardown residue), short (1..255 queued, the coalescing signal),
and empty. The empty case is reachable and was missed in drafting: a stale
coalesced wake exits the idle loop with both lanes empty, and the terminal
guard returns only when `ended`, so takeBatch produces a zero-frame batch and
the spine opens a stream carrying nothing. takeBatch has no empty guard.
Counting it separately keeps the other three honest -- folded into short it
would inflate the tiny-batch rate that is precisely the signal this issue
wants, making a wasted round trip look like aggressive coalescing.
Adds a batch-size histogram, the first in this module. Effect requires an
explicit boundary spec; MetricBoundaries.exponential({start:1,factor:2,
count:10}) gives [1,2,4,8,16,32,64,128,256] plus +Inf, verified by executing
it rather than reading the types. Power-of-two buckets hold constant relative
resolution where the variation is, the top boundary lands exactly on
PUBLISH_BATCH_MAX so saturation is one bucket delta, and +Inf stays
structurally empty as an invariant check.
Purely additive: Decision 2's rows and prose are untouched, following the
Decision 3a precedent in compass-agent-loop-otel. The freeze protects decision
content, and this rewrites none.
Ledger-impact: none
Co-authored-by: Matt Wilkinson <matt@rigel.build>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Compass engineering docs preview: https://compass-obs-rig-3694-flush-s.compass-eng-docs.pages.dev Deployed from Changed pages: |
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.
Design only; the implementation follows against this frozen record.
RIG-3694 asks whether turn coalescing produces many tiny batches or
saturates the cap. No existing instrument answers it: the twelve metrics in
Decision 2 count losses, retries, and depths, and a raw batch rate is
uninterpretable without knowing WHY each batch flushed.
The filed size/timer/shutdown taxonomy does not survive contact with the
code. The spine has no timed flush: pumpLoop's only idle wait is the wake
latch, the sole Effect.sleep is the priority-retry backoff, and takeBatch
never waits for a fuller batch. A reason="timer" label could never be
incremented, and an inert label is forbidden, so it is excluded.
The code-true taxonomy is four reasons, not three: full (the cap closed the
batch), drain (teardown residue), short (1..255 queued, the coalescing signal),
and empty. The empty case is reachable and was missed in drafting: a stale
coalesced wake exits the idle loop with both lanes empty, and the terminal
guard returns only when
ended, so takeBatch produces a zero-frame batch andthe spine opens a stream carrying nothing. takeBatch has no empty guard.
Counting it separately keeps the other three honest -- folded into short it
would inflate the tiny-batch rate that is precisely the signal this issue
wants, making a wasted round trip look like aggressive coalescing.
Adds a batch-size histogram, the first in this module. Effect requires an
explicit boundary spec; MetricBoundaries.exponential({start:1,factor:2,
count:10}) gives [1,2,4,8,16,32,64,128,256] plus +Inf, verified by executing
it rather than reading the types. Power-of-two buckets hold constant relative
resolution where the variation is, the top boundary lands exactly on
PUBLISH_BATCH_MAX so saturation is one bucket delta, and +Inf stays
structurally empty as an invariant check.
Purely additive: Decision 2's rows and prose are untouched, following the
Decision 3a precedent in compass-agent-loop-otel. The freeze protects decision
content, and this rewrites none.
Ledger-impact: none
Co-authored-by: Matt Wilkinson matt@rigel.build