8000 Observability phase 3a: Meter streaming hook by pabloos · Pull Request #4 · pabloos/flow · GitHub
[go: up one dir, main page]

Skip to content

Observability phase 3a: Meter streaming hook - #4

Merged
pabloos merged 1 commit into
mainfrom
feat/observe-meter
Sep 22, 2026
Merged

pabloos merged 1 commit into
mainfrom
feat/observe-meter

Conversation

@pabloos
@pabloos pabloos commented Sep 22, 2026
Copy link
Copy Markdown
Owner

Observability phase 3a — the core streaming-metrics hook (candidate for v0.5.0). Additive, backward-compatible, and still zero-dependency.

Adds

  • Meter extension point (instrument-based, à la OpenTelemetry):
    type Meter     interface { Counter(name string) Counter; Histogram(name string) Histogram }
    type Counter   interface { Add(n int64) }
    type Histogram interface { Record(d time.Duration) }
  • WithMeter(m Meter) — the engine records produced / processed / emitted / consumed counters and a process_latency histogram on the hot path.

Design

  • Streaming (vs Observe's end-of-run snapshot), so it fits long-lived / infinite pipelines. Both can be set in the same run.
  • Instrument-based rather than an event stream: the backend aggregates, and an OTel exporter is nearly a passthrough.
  • Opt-in and cheap: with no Meter, the hot path pays nothing. Instrument methods must be concurrency-safe (documented) — validated by an in-memory fake meter under -race.

Boundary

Meter is stdlib-only, so the core stays zero-dep. Concrete exporters (Prometheus first, then OpenTelemetry) will land as separate submodules under flow/x/… with their own go.mod — phase 3b.

The observability API stays marked experimental while v0.x.

Add the Meter extension point (instrument-based, OpenTelemetry-shaped: Counter
and Histogram) plus the WithMeter option. The engine records the produced /
processed / emitted / consumed counters and a process_latency histogram to the
meter's instruments on the hot path — opt-in, and alongside Observe.

Kept tiny and stdlib-only so the core stays zero-dependency; concrete exporters
(Prometheus, OpenTelemetry) will live in separate submodules under x/. Verified
with an in-memory fake meter under -race.
@pabloos
pabloos merged commit 83af986 into main Sep 22, 2026
2 checks passed
@pabloos
pabloos deleted the feat/observe-meter branch September 22, 2026 12:24
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

0