Repository navigation
Set ServiceMonitor pod label from __meta_kubernetes_pod_name - #111
Open
sheikh-arman wants to merge 2 commits into
Open
sheikh-arman wants to merge 2 commits into
sheikh-arman wants to merge 2 commits into
Conversation
The pod relabel read __meta_kubernetes_endpoint_address_target_name, which only the Endpoints discovery role sets. With the EndpointSlice role (Prometheus Operator serviceDiscoveryRole: EndpointSlice, Grafana Alloy / k8s-monitoring) that label is empty, and a replace from an empty source removes the pod label the scraper had already set. Every series from a *-stats target then lacks pod, so dashboards that filter on pod show no data. Read __meta_kubernetes_pod_name instead: Prometheus sets it for pod targets under both roles, and for a pod target its value equals the target name, so Endpoints users get identical series. Regex (.+) keeps an existing pod label when the source is empty. Add a unit test for the generated relabel config, and vendor the fake clients it uses. Signed-off-by: SK Ali Arman <arman@appscode.com>
Drop agents/prometheusoperator/lib_test.go and re-vendor; the fake clients were only vendored for that test. The change is now only the relabel source in lib.go. Signed-off-by: SK Ali Arman <arman@appscode.com>
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.
The pod relabel read __meta_kubernetes_endpoint_address_target_name, which only the Endpoints discovery role sets. With the EndpointSlice role (Prometheus Operator serviceDiscoveryRole: EndpointSlice, Grafana Alloy / k8s-monitoring) that label is empty, and a replace from an empty source removes the pod label the scraper had already set. Every series from a *-stats target then lacks pod, so dashboards that filter on pod show no data.
Read __meta_kubernetes_pod_name instead: Prometheus sets it for pod targets under both roles, and for a pod target its value equals the target name, so Endpoints users get identical series. Regex (.+) keeps an existing pod label when the source is empty.
Add a unit test for the generated relabel config, and vendor the fake clients it uses.