fix(workload-alloy): correct metric_pods relabel (follow-up #206)#40
Merged
danielgines merged 1 commit intomainfrom May 4, 2026
Merged
Conversation
Same regex bug shipped fixed in the hub Alloy via upstream PR #148:
the previous rule used only the prometheus.io/port annotation as
source label with regex "(.+)" and replacement "${1}:$0", causing
both backrefs to resolve to the captured port value. The result was
__address__="<port>:<port>" (e.g. "9090:9090") instead of the
expected "<pod_ip>:<port>". Any pod relying on annotation-based
scrape on a workload cluster never had its /metrics endpoint reached.
Replaced with the canonical Prometheus pattern: combine __address__
(pod IP from discovery) with the annotation port, matching
"([^:]+)(?::\d+)?;(\d+)" and replacing with "$1:$2". Also added a
companion rule honoring prometheus.io/path when present.
Workload Alloy does not run an OTLP receiver — only the hub does —
so Bug 2 from the original issue does not apply here. Single-edit
fix, ~15 lines.
Validation:
- helm template grafana/alloy --version 1.6.2 -f values/workload/alloy.yaml
renders cleanly.
- alloy fmt + alloy run on the rendered config exit 0 (only the
expected sys.env() errors fire when run offline without the
LOKI_PUSH_URL / MIMIR_PUSH_URL / CLUSTER_NAME env vars set).
Lower urgency than the hub fix because there are no workload clusters
in production at the time of writing; merging keeps the workload
alloy ready for the first cluster that gets provisioned.
Closes Estabilis/estabilis-platform-tools#210
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Same
metric_podsrelabel bug shipped fixed in the hub Alloy via Estabilis/estabilis-platform#148 — applies to the workload Alloy values too. Without this fix, any pod withprometheus.io/scrape=trueannotation on a workload cluster has its/metricsendpoint silently unreachable (the rule wrote__address__="<port>:<port>"instead of"<pod_ip>:<port>").Diff
Replaces the broken rule with the canonical Prometheus pattern (combine
__address__with the annotation port), and adds a companion rule honoringprometheus.io/pathwhen present.Scope vs hub fix
Test plan
helm template grafana/alloy --version 1.6.2 -f values/workload/alloy.yamlrenders cleanly.alloy fmton rendered config: exit 0.alloy runon rendered config: exit 0; only the expectedsys.env()errors when run offline.Urgency
Lower than the hub fix — no workload clusters in production at the time of writing. Merging keeps the workload Alloy ready for the first cluster that gets provisioned.
Closes Estabilis/estabilis-platform-tools#210