Repository navigation
Conversation
…as per window)
Every collector view state now carries its lineage, the records one
collector instance sends for one (view, series, window):
- asap.producer_epoch (Metric metadata, decimal text of a u64): the
instance, a random number drawn when the executor starts; states of two
epochs are two Metric entries.
- asap.sequence (int), asap.state_kind ("full" | "delta") and
asap.base_sequence (int, deltas only) on each point: record 0 is a full,
record n >= 1 a delta on n - 1.
Each emission of a window is the state of the samples taken since the
previous one: the window's run is sealed and the next sample starts a new
run. So corrections of late samples are deltas, and the new optional
processor setting open_window_emit_interval_ms (default off: a window is
emitted at its close, as before) also emits open windows, as a full and
then deltas, so ASAPQuery-backend answers them with fresh partial states.
For DDSketch a delta is exactly the new samples' bucket counts; for KLL it
is a KLL of the new samples, which merges within the sketch's rank error.
Sequences are kept per run group, window and series (by a hash of the
series key, since series ids are reused) while the window is within
retention; the views of a group filter by labels only, so this is each
view's lineage. Two corrections with equal bytes now get sequences 1 and 2
instead of looking like one retry. A new counter states.delta counts the
deltas sent.
collector-views.json may carry window_close_delay_ms (copied by the
control plane for ASAPQuery-backend's idle close); the loader accepts and
ignores it, and still refuses unknown fields.
The golden on-time states file is unchanged: its test now strips the
lineage (epoch metadata, sequence 0, kind full) from the emitted messages
and compares them with the file's. The q01 wire example
tests/fixtures/collector-views/q01/otlp-body.pb is regenerated with a
fixed epoch (9241337045811906213) and the full's lineage attributes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf
This was referenced Nov 30, 2026
collector_views: carry the lineage in a binary frame in sketch.envelope (48.7 → 3.8 B per state)
#64
Draft
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.
What to review
Collector view states now carry sequence numbers, and a window can be sent more than once as deltas. The receiver rules are in ASAPQuery-backend's design doc (
docs/design/collector-sketch-ingest.md, section 8). Its PR will be stacked on the collector-views-file PR.asap.producer_epoch: Metric metadata, decimal text of a u64. A random number drawn when the collector starts.asap.sequence: int.asap.state_kind:"full"or"delta".asap.base_sequence: int, deltas only.open_window_emit_interval_ms(off by default) also emits open windows, so the backend can answer them with fresh partial states.tests/golden/collector-views-states.binis unchanged. Its test strips the lineage and compares messages.collector-views.json: acceptswindow_close_delay_msand ignores it. ASAPQuery-backend's idle close reads it.Interfaces
The decoder reads the lineage back into
SketchEnvelope::lineage, and the lineage attributes are not labels. If the epoch, sequence, kind and base are partial or disagree, decoding fails. On the OTAP Arrow path, a full's sequence 0 can be left out by the sparse int encoding, so the decoder reads a full with no sequence as sequence 0. OTLP keeps the 0.Tests
Command:
cargo test --features otap-engine --lib(158 passed) plus--test collector_views_e2e --test otap_pipeline_e2e --test runtime.cargo fmtandcargo clippy --all-targets --features otap-engine,stream-benchmark -- -D warningsare clean.New tests:
ddsketch_full_and_deltas_equal_the_at_close_state: open-window emissions, the close and a correction, merged in order, give the at-close state byte for byte.kll_full_and_deltas_are_within_the_bound_of_the_at_close_state: rank error ≤ 1.65 % (k = 200).corrections_with_equal_bytes_have_distinct_sequences: equal payloads get sequence 1 (base 0) and sequence 2 (base 1).a_restart_starts_each_window_with_a_full_of_a_new_epochopen_window_emission_keeps_the_window_opena_delta_round_trips_and_epochs_are_separate_metricsan_inconsistent_lineage_is_refused_on_decodea_file_with_the_window_close_delay_loadsemitted_states_match_the_golden_bytes(rewritten): the golden file is unchanged, and the emitted messages less the lineage equal it.q01_otlp_body_matches_golden: the fixturetests/fixtures/collector-views/q01/otlp-body.pbis regenerated with fixed epoch 9241337045811906213 and the full's lineage attributes.Decisions (2026-11-30, ASAPQuery-backend design doc §8, decisions 30–34)
sketch.envelopein collector_views: carry the lineage in a binary frame in sketch.envelope (48.7 → 3.8 B per state) #64, stacked on collector_views: find a point's series by its attribute bytes (1.27 → 1.11 µs/sample) #62. On the golden on-time states the lineage cost drops from 48.7 B per state to 3.8 B. The producer epoch stays in the metric metadata.window_close_delay_ms, so a concurrent exporter does not produce false gaps.Open questions
🤖 Generated with Claude Code
https://claude.ai/code/session_01K1M6bo8kYWd83zXwh2Nobf