-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add timezone to kube_cronjob_info / Make kube_cronjob_next_schedule_time timezone-aware #2376
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mrueg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
831db76
to
be6fc00
Compare
1bb6417
to
cd08464
Compare
cd08464
to
98daf12
Compare
6b1fa06
to
35252bd
Compare
35252bd
to
569e820
Compare
return &metric.Family{ | ||
Metrics: []*metric.Metric{ | ||
{ | ||
LabelKeys: []string{"schedule", "concurrency_policy"}, | ||
LabelValues: []string{j.Spec.Schedule, string(j.Spec.ConcurrencyPolicy)}, | ||
LabelKeys: []string{"schedule", "concurrency_policy", "timezone"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it be better in its own metric rather than in the info metric?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a 1:1 relationship, why would you prefer a dedicated metric for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dgrisonnet any feedback here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_info
is not a very intuitive suffix which is why I don't really like these metrics where we just end up dumping a bunch of labels that aren't really related between one another.
I don't know what was the historical reasoning for putting labels into these metrics, but I can also see some dedicated metrics for values part of objects spec:
kube-state-metrics/internal/store/pod.go
Lines 1212 to 1231 in 569e820
func createPodRestartPolicyFamilyGenerator() generator.FamilyGenerator { | |
return *generator.NewFamilyGeneratorWithStability( | |
"kube_pod_restart_policy", | |
"Describes the restart policy in use by this pod.", | |
metric.Gauge, | |
basemetrics.STABLE, | |
"", | |
wrapPodFunc(func(p *v1.Pod) *metric.Family { | |
return &metric.Family{ | |
Metrics: []*metric.Metric{ | |
{ | |
LabelKeys: []string{"type"}, | |
LabelValues: []string{string(p.Spec.RestartPolicy)}, | |
Value: float64(1), | |
}, | |
}, | |
} | |
}), | |
) | |
} |
To me, info should be limited to the default labels. Any other information that we want to expose should be in its own dedicated metric. What is your opinion on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree on having a separate metric for anything that does not have a 1:n relationship within the object. For 1:1 relationships, additional time series make it difficult to correlate between multiple labels vs. simply extracting the ones you need:
max(resource_info) by (label1, label2, label3)
.
Trying to do the same with multiple metrics can get very annoying and more error-prone.
To me, the _info metric should describe all single-value keys of the object that are static over its lifetime and non-numeric.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to define it here:
the _info metric should describe all single-value keys of the object that are static over its lifetime and non-numeric
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant a documentation/standard of sorts in the repository that enforces this. Not sure if there is one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add that in a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm currently working on a tool that will generate ideal metric names but it will take some time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the tool's definition of an incorrect or correct metric representation for a nested object needs to weigh in the point Damien raised above.
Basically, are we in consensus on what is the standard approach for representing a nested value (since more granularity leads to more joins, but more abstractions lead to more cardinal label-sets (which is comparatively more harmful))?
/triage accepted |
@dgrisonnet @rexagod anything left to do to get this change in? |
@dgrisonnet @rexagod Sorry for the ping, but this feature is pretty important to us since we can't set the timezone on AWS' Bottlerocket OS. Is there any way to accelerate the review process? |
What this PR does / why we need it:
Cronjob is not timezone aware.
How does this change affect the cardinality of KSM: (increases, decreases or does not change cardinality)
Adds one label to the kube_cronjob_info metric.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #2206