-
Notifications
You must be signed in to change notification settings - Fork 240
Add semconv for k8s node condition as metric #2321
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: ChrsMark <[email protected]>
model/k8s/registry.yaml
Outdated
brief: | | ||
The node is healthy and ready to accept pods. and Unknown if the node controller has not heard from the node in the last node-monitor-grace-period" | ||
stability: development | ||
- id: ready_unknown |
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.
This doesn't seem to be listed in node conditions. Is this just because it is the only condition that can be unknown in addition to t/f?
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.
Right, but we can avoid this by using the k8s.condition.status
with values T/F/unknown. Should be fixed by
34f1e08.
Also, note that beyond these listed conditions there might other custom ones defined. So it's safer to have the option to track unknown
status properly.
model/k8s/registry.yaml
Outdated
@@ -434,6 +434,43 @@ groups: | |||
value: 'terminating' | |||
brief: "Terminating namespace phase as described by [K8s API](https://pkg.go.dev/k8s.io/[email protected]/core/v1#NamespacePhase)" | |||
stability: development | |||
- id: k8s.node.condition |
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.
Did we consider using k8s.condition.type
and k8s.condition.status
(without node/pod namespace)? I know technically all of the XXXCondition types are separate, but they all follow the same type/status/reason pattern.
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.
What values would k8s.condition.status
and k8s.condition.type
accept?
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.
Status would have T/F/unknown. Type would be open-ended, but we could provide examples from common objects
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 see!
It seems kube-state-metrics follows the same pattern here: https://github.com/kubernetes/kube-state-metrics/blob/v2.15.0/docs/metrics/cluster/node-metrics.md?plain=1#L14
I will change it like this 👍
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.
Out of curiosity, does KSM have reason as a label? That seems like it would be useful, although it is somewhat higher cardinality
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 are some reason labels for containers' and Pods' statuses but not for Node's conditions: https://github.com/kubernetes/kube-state-metrics/blob/v2.15.0/docs/metrics/workload/pod-metrics.md
For containers' status we have it already in SemConv: https://github.com/open-telemetry/semantic-conventions/blob/main/model/k8s/metrics.yaml#L80
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 would lean towards adding it, but if we are unsure, we can always do that later.
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.
Good idea! I have added it.
The modeling of this metric is becoming a bit tricky because we have to ensure that metric's name does not collide with a namespace. k8s.node.condition
cannot be the metric name and a namespace for the attributes at the same time. Let me know what you think about the current suggestion.
Signed-off-by: ChrsMark <[email protected]>
Signed-off-by: ChrsMark <[email protected]>
Fixes #2077
Changes
This PR adds the
k8s.node.condition
metricMerge requirement checklist
[chore]