Skip to content

feat(observability): MetricsRecorder port + NoOp adapter (v26.06.72)#99

Merged
ancongui merged 1 commit into
mainfrom
feat/observability-metrics-port
Jun 7, 2026
Merged

feat(observability): MetricsRecorder port + NoOp adapter (v26.06.72)#99
ancongui merged 1 commit into
mainfrom
feat/observability-metrics-port

Conversation

@ancongui
Copy link
Copy Markdown
Contributor

@ancongui ancongui commented Jun 7, 2026

Audit follow-up (#2 — observability had no port abstraction). Adds a MetricsRecorder protocol port (the counter/histogram/gauge recording contract) so instrumentation isn't hard-coupled to Prometheus, plus NoOpMetricsRecorder — a dependency-free adapter for tests and metrics-disabled deployments (every op is an inert no-op handle). MetricsRegistry now nominally implements the port (the Prometheus adapter).

Note: tracing exporters were already config-swappable (pyfly.observability.tracing.exporter=otlp|console|none), so a full multi-backend metrics abstraction would be YAGNI — this stays a lightweight port + one real alternative adapter, not a speculative refactor. Tests (2). Gates: mypy --strict (638), ruff+format, full suite green.

…er + bump v26.06.72

Audit follow-up (observability had no port abstraction). Added MetricsRecorder Protocol (the
counter/histogram/gauge recording contract) in observability/ports.py + NoOpMetricsRecorder (inert
handles) for tests / metrics-disabled deployments. MetricsRegistry now nominally implements the port
(Prometheus adapter). Tracing exporters were already config-swappable (otlp|console|none), so a full
multi-backend metrics abstraction would be YAGNI — kept this a lightweight port + one real alt adapter.

Tests: tests/observability/test_metrics_recorder_port.py (2). Gates: mypy --strict (638), ruff +
format, full suite green.
@ancongui ancongui merged commit fdac602 into main Jun 7, 2026
5 checks passed
@ancongui ancongui deleted the feat/observability-metrics-port branch June 7, 2026 19:36
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