helm: add service_name relabel rule to alloy scrape config#5262
Open
SLoeuillet wants to merge 2 commits into
Open
helm: add service_name relabel rule to alloy scrape config#5262SLoeuillet wants to merge 2 commits into
SLoeuillet wants to merge 2 commits into
Conversation
The default Alloy scrape config maps the profiles.grafana.com/service_repository, service_git_ref and service_root_path annotations to labels, but not service_name. Without an explicit service_name label, Alloy falls back to inferring it from the target metadata (e.g. namespace + app.kubernetes.io labels), which is often not what the user intends — a pod whose inferred name is generic (a component literally named "default", etc.) shows up under a useless service_name and cannot be overridden via annotation like the other service_* labels can. Add a relabel rule mapping profiles.grafana.com/service_name to the service_name label, consistent with the existing service_repository / service_git_ref / service_root_path rules. No-op unless a pod sets the annotation, so existing deployments are unaffected. Regenerated rendered manifests and bumped the chart version. Closes grafana#2051 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Stephane Loeuillet <stephane.loeuillet@kaiko.com>
|
|
1 similar comment
|
|
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.
What
Adds a relabel rule to the Helm chart's default Alloy scrape config that maps the
profiles.grafana.com/service_namepod annotation to theservice_namelabel:rule { action = "replace" source_labels = ["__meta_kubernetes_pod_annotation_profiles_grafana_com_service_name"] target_label = "service_name" }It sits alongside the existing
service_repository/service_git_ref/service_root_pathrules intemplates/configmap-alloy.yaml.Why
The chart already lets users set
service_repository,service_git_refandservice_root_pathviaprofiles.grafana.com/*annotations, but notservice_name— the single most important label, used by the App Selector to identify an application (#2051).Without it, Alloy falls back to inferring
service_namefrom target metadata (namespace +app.kubernetes.io/*). When that inference is generic — e.g. a Helm component literally nameddefault— pods surface under a useless/collidingservice_name(<namespace>/default) with no annotation-based way to override it, unlike every otherservice_*label. This rule closes that gap so an operator can simply setprofiles.grafana.com/service_name: my-app.Behaviour / compatibility
service_namelabel takes precedence over Alloy's inference, so existing deployments are completely unaffected until they opt in.service_*annotation rules — same block, same placement.Changes
templates/configmap-alloy.yaml— the new rule.rendered/*.yaml— regenerated (the rule is in the static config block, so it appears identically in all six fixtures).Chart.yaml/README.md— chartversion2.0.3 → 2.0.4 (appVersion unchanged).Closes #2051