Skip to content

edge(asapedgeprocessor): wake-on-demand sub-window flush (generic plumbing) - #521

Merged
zzylol merged 1 commit into
mainfrom
split/pr-transport-wake
Jul 16, 2026
Merged

zzylol merged 1 commit into
mainfrom
split/pr-transport-wake

Conversation

@zzylol

@zzylol zzylol commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Third PR in the split stack (cleanup #516 → NitroSketch #518/#519 aside → GOS docs #520this → per-family GOS PRs). Base: #520.

Adds the generic wake-on-demand mechanism §11 of docs/design-gos-unified-edge-telemetry.md (#520) describes: a wakeCh on asapEdgeProcessor and a non-blocking wakeSubWindow() trigger, wired into flushLoop's select alongside the existing subC (SubWindowInterval) ticker and the window-boundary ticker.

case <-subC:
    p.flushSubWindow(context.Background())
case <-p.wakeCh:          // new
    p.flushSubWindow(context.Background())
case <-t.C:
    ...

No sketch family calls wakeSubWindow() yet — that starts with the CountSketch GOS conversion (next PR in the stack). This PR only lands the plumbing so each per-family PR can wire into it without also touching flush.go.

Scope note (also flagged in-code): flushSubWindow's own subWindowEnabled() guard is dropped — it was already redundant (the subC channel only fires when that's true), and it would otherwise silently swallow a wake when SubWindowInterval is unset. The deeper per-series gate (sa.subWindowEnabled() in warm_sketch.go, which still requires SubWindowInterval>0) is intentionally left alone here — a GOS-only family with no legacy sub-window interval configured won't see any effect from a wake until that gate is decoupled, which is the first per-family PR's job, not this one's.

Existing subC/ticker-driven flush behavior is unchanged — this is purely additive.

Test plan

  • go build/go vet/go test ./... clean on opentelemetry-collector-contrib-patch/processor/asapedgeprocessor.
  • New test TestWakeSubWindowFlushesBeforeTicker: configures SubWindowInterval=30m (far longer than the test runs), feeds one Sum data point, calls wakeSubWindow() twice back-to-back (proving the non-blocking send doesn't block on a pending wake), and asserts a flush is observed within 2s — output that could only have come from the wake, not the ticker.
  • CI.

🤖 Generated with Claude Code

…mbing)

Adds a wakeCh to asapEdgeProcessor and a non-blocking wakeSubWindow()
trigger, wired into flushLoop's select alongside the existing subC ticker
and window-boundary ticker. This is the mechanism §11 of
docs/design-gos-unified-edge-telemetry.md (#520) describes: per-family
GOS insert-time threshold crossings will call wakeSubWindow() to get their
delta flushed immediately instead of waiting for the next SubWindowInterval
tick — no family wires into it yet (that starts with the CountSketch
conversion, next in the stack).

flushSubWindow's own subWindowEnabled() guard is dropped (it was already
redundant given subC only fires when that's true; it would otherwise
silently eat a wake when SubWindowInterval is unset). The deeper per-series
gate (sa.subWindowEnabled(), which still requires SubWindowInterval>0) is
untouched here and is next in line to decouple as GOS families land.

Existing subC/ticker-driven flush behavior is unchanged — this is purely
additive.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@zzylol
zzylol changed the base branch from split/pr-gos-docs to main July 16, 2026 19:29
@zzylol
zzylol merged commit 75c65b2 into main Jul 16, 2026
@zzylol
zzylol deleted the split/pr-transport-wake branch July 17, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant