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 that sets service_name from the first non-empty value of an
ordered annotation list, matching the logic in the k8s-monitoring-helm chart's
feature-profiling eBPF config:
- profiles.grafana.com/service_name
- resource.opentelemetry.io/service.name
No-op unless a pod sets one of these annotations, so existing deployments are
unaffected. Regenerated rendered manifests and bumped the chart version.
Closes #2051
Signed-off-by: Stephane Loeuillet <stephane.loeuillet@kaiko.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>