Skip to content

fix(metric): substitute {PREFIX} in kube-client MetricsAdapter#875

Open
aspr0d wants to merge 1 commit into
flant:mainfrom
aspr0d:fix/865-malformed-metric-prefix
Open

fix(metric): substitute {PREFIX} in kube-client MetricsAdapter#875
aspr0d wants to merge 1 commit into
flant:mainfrom
aspr0d:fix/865-malformed-metric-prefix

Conversation

@aspr0d
Copy link
Copy Markdown

@aspr0d aspr0d commented May 16, 2026

What

Fixes #865

kube-client passes metric names containing a {PREFIX} placeholder through MetricsAdapter. The adapter forwarded those names unchanged, so Prometheus exposed series like _PREFIX_kubernetes_client_rate_limiter_latency_seconds on /metrics.

Changes

  • MetricsAdapter now takes the configured Prometheus metrics prefix and applies metrics.ReplacePrefix before register/add/observe calls
  • Wire app.PrometheusMetricsPrefix from kube_client.go
  • Unit tests in pkg/metric/adapter_test.go

Verification

go test ./pkg/metric/... -count=1

kube-client registers metrics with a {PREFIX} placeholder in the name.
MetricsAdapter forwarded those names unchanged, so Prometheus exposed
_PREFIX_* series on /metrics.

Apply app.PrometheusMetricsPrefix via metrics.ReplacePrefix before
registering or updating metrics in the adapter.
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.

malformed metric is produced on the operator's own /metrics page

1 participant