8000 Add Prometheus exporter as a separate module (x/prometheus) by pabloos · Pull Request #5 · pabloos/flow · GitHub
[go: up one dir, main page]

Skip to content
8000

Add Prometheus exporter as a separate module (x/prometheus) - #5

Merged
pabloos merged 1 commit into
mainfrom
feat/prometheus-exporter
Sep 23, 2026
Merged

pabloos merged 1 commit into
mainfrom
feat/prometheus-exporter

Conversation

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

Observability phase 3b — the first metrics exporter, as a separate module.

What

x/prometheus is its own module (github.com/pabloos/flow/x/prometheus, own go.mod) implementing flow.Meter on prometheus/client_golang:

reg := prometheus.NewRegistry()
m := flowprom.NewMeter(reg)
flow.Run(ctx, prod, proc, cons, flow.WithMeter(m))
  • Counters → flow_<name>_total; process_latency → flow_process_latency_seconds.
  • Instruments are memoized, so a Meter can be reused across runs without duplicate registration (tested).

Why a separate module

The core flow module stays zero-dependency — only code that imports x/prometheus pulls in client_golang. This is the boundary we agreed: contract in core, dependency-carrying exporters outside.

Notes

  • Pinned to client_golang v1.20.5 to keep the module on Go 1.23 (latest pulls in a Go 1.25 requirement).
  • Requires the core at v0.5.0 (the release that added Meter).
  • CI now also vets and race-tests x/* submodules.
  • Versioned independently — it will be tagged x/prometheus/v0.1.0 after merge (Go's path-prefixed submodule tag convention).

Observability phase 3b: x/prometheus is its own module (own go.mod)
implementing flow.Meter on prometheus/client_golang, so the core stays
zero-dependency — only importers of the exporter pull client_golang in.

NewMeter(reg) maps flow's instruments to flow_<name>_total counters and a
flow_process_latency_seconds histogram; instruments are memoized so a Meter can
be reused across runs without duplicate registration. Pinned to client_golang
v1.20.5 to keep the module on Go 1.23. CI now also vets and race-tests x/*.
@pabloos
pabloos merged commit 6278f68 into main Sep 23, 2026
2 checks passed
@pabloos
pabloos deleted the feat/prometheus-exporter branch September 23, 2026 07:22
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