embed: make a non-Gatherer MetricsRegisterer an error (deprecation follow-up to #2747)
- Dominant language
- Go
- Stars
- 610
- Forks
- 63
- Avg merge
- 12h 28m
- Merged PRs (30d)
- 57
Description
#2747 fixed `/metrics` to serve the embedder's own gatherer. A `MetricsRegisterer` that does not implement `prometheus.Gatherer` (anything from `prometheus.WrapRegisterer*`) cannot back that endpoint.
That configuration started in earlier releases, so v0.20 **warns and degrades**: Conduit logs `pkgconduit.MetricsDegradedWarning` and keeps serving the process-global default registry — the pre-existing, wrong-but-harmless behavior — rather than refusing to start. Killing a running system on upgrade over a wrong scrape target inverts the cost, and the deprecation policy (announce → warn → remove, minimum two minor versions) exists for exactly this.
**This issue is the 'remove' step.** In the next minor, `pkg/conduit.ResolveMetricsGatherer` should return `conduiterr.CodeInvalidArgument` for that case instead of setting `MetricsResolution.Degraded`.
Touch points:
- `pkg/conduit/runtime.go` — `ResolveMetricsGatherer`, `MetricsResolution.Degraded`, `MetricsDegradedWarning`
- `conduit.go` — `Options.MetricsGatherer` godoc says 'the next minor turns that into an error'
- `pkg/conduit/runtime.go` — `WithMetricsRegisterer` godoc says the same
- Tests asserting the degrade path: `TestNewRuntimeDegradesForWrappedRegisterer`, `TestNewRuntimeWarnsWhenMetricsResolutionDegrades`, `TestNew_WrappedRegistererWithoutGatherer_Degrades`
Ship the removal with a release note; the warning has to have been live for at least one minor first.
Contributor guide
Research direction
Start in pkg/conduit/runtime.go at ResolveMetricsGatherer and review MetricsResolution.Degraded and MetricsDegradedWarning, then check the related godoc in conduit.go and WithMetricsRegisterer. Update the three named degrade-path tests to cover the invalid-argument result and add the required release note. Done means wrapped registerers no longer degrade to the global registry and the documentation matches the new behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100