Skip to content

Add OpenTelemetry exporter as a separate module (x/otel) - #7

Merged
pabloos merged 1 commit into
mainfrom
feat/otel-exporter
Nov 1, 2026
Merged

pabloos merged 1 commit into
mainfrom
feat/otel-exporter

Conversation

@pabloos

@pabloos pabloos commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Replicates the x/prometheus pattern for OpenTelemetry: a flow.Meter backed by an OTel metric.Meter, in its own module so the flow core stays zero-dependency — only importers of x/otel pull in OpenTelemetry.

What's here

  • x/otel/otel.go — NewMeter(metric.Meter) flow.Meter. Counters → flow.<name> (Int64), the process_latency histogram → flow.process_latency (Float64, seconds). Instruments are memoized so a Meter can be reused across runs. Histogram buckets are cloned from Prometheus DefBuckets so both exporters report comparable distributions. A failed instrument panics (misconfiguration, not a runtime condition — same stance as promauto).
  • x/otel/otel_test.go — two tests against the SDK ManualReader: per-metric counts (5/5/10/10 + 5 latency samples, matching the Prometheus test) and Meter reuse across 3 runs. Green under -race.
  • x/otel/go.mod / go.sum — pinned to OTel v1.32.0; depends only on otel/metric (API) + otel/sdk/metric (tests).
  • README.md — OTel exporter example alongside Prometheus; roadmap marks both exporters done.

Verification

go vet + go build + go test -race on core and over the x/*/ submodule loop — all ok. CI already iterates x/*/, so it picks up x/otel automatically.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LGsdwoFd3a7bejBXLr6saG

Mirrors x/prometheus: a flow.Meter backed by an OTel metric.Meter,
in its own module so the core stays zero-dependency. Counters map to
flow.<name> (Int64), process_latency to a Float64 histogram in seconds
with buckets cloned from Prometheus DefBuckets for comparable output.
Instruments are memoized so a Meter can be reused across runs.

README gains the OTel exporter example; roadmap marks both exporters done.
@pabloos
pabloos merged commit 47ed9bf into main Nov 1, 2026
2 checks passed
@pabloos
pabloos deleted the feat/otel-exporter branch November 1, 2026 18:46
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