Fix kubernetes job and workload labeling#75
Open
westaylor wants to merge 2 commits intografana:mainfrom
Open
Conversation
|
|
bentonam
approved these changes
Jun 3, 2025
0ddac61 to
8a6ede0
Compare
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.
Hi, this is my first contribution to Grafana, let me know if there's anything else this needs thanks!
This PR has two commits:
fix kube label used for metrics job label
there's one spot in code using
__meta_kubernetes_pod_controller_typebut everywhere else this iscontroller_kindprometheus docs and alloy docs both say
controller_kindis the correct label and there is nocontroller_typeI checked, and unfortunately looks like chatgpt and google gemini are both saying controller_type is a real value when it's not
update regex used for workload and job labels
there's 4 labels to consider here:
workloadandjobin metrics, andworkloadandjobin logsworkloadandjobshare the same processing step, and in the log pipeline it directly copies the workload value to the job label making them identicalthe input to the regex is the
controller_kindlabel. before it was only running onReplicaSetbut at minimum it needs to beReplicaSet|JobTo Note: there are 18 other instances of
regex = "(ReplicaSet/.+)-.+"across the named modules. I've only updated the regex in the generic kubernetes log and metric scrape jobs. I wanted to ask if you think we should just update this regex everywhere in this or another PR, or if the maintainers of database/networking/etc know it only ever runs ReplicaSets and doesn't need a Job checkthe reason these two commits are paired together is because the metrics
joblabel, by using a nonexistent namecontroller_kind, never ran the regex and ended up with the correct value in the job label from an earlier step.current state on main: 1/4 labels works by accident
commit 1: corrects label, breaking the end result
commit 2: fixes 4/4 labels