-
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 restartPolicy to kube_pod_init_container_info
metric
#2240
Changes from 2 commits
fc1831d
ed1a7f9
b948807
091ddf9
f94716a
5834d64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -677,16 +677,21 @@ func createPodInitContainerInfoFamilyGenerator() generator.FamilyGenerator { | |||||
"", | ||||||
wrapPodFunc(func(p *v1.Pod) *metric.Family { | ||||||
ms := []*metric.Metric{} | ||||||
labelKeys := []string{"container", "image_spec", "image", "image_id", "container_id"} | ||||||
labelKeys := []string{"container", "image_spec", "image", "image_id", "container_id", "type"} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
let's use the kubernetes specific labels There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mrueg nice i fixed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, that one is in a separate metric, I think if this is in an Info metric it's too generic to call it type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mrueg |
||||||
|
||||||
for _, c := range p.Spec.InitContainers { | ||||||
restartPolicy := "" | ||||||
if c.RestartPolicy != nil { | ||||||
restartPolicy = string(*c.RestartPolicy) | ||||||
} | ||||||
|
||||||
for _, cs := range p.Status.InitContainerStatuses { | ||||||
if cs.Name != c.Name { | ||||||
continue | ||||||
} | ||||||
ms = append(ms, &metric.Metric{ | ||||||
LabelKeys: labelKeys, | ||||||
LabelValues: []string{cs.Name, c.Image, cs.Image, cs.ImageID, cs.ContainerID}, | ||||||
LabelValues: []string{cs.Name, c.Image, cs.Image, cs.ImageID, cs.ContainerID, restartPolicy}, | ||||||
Value: 1, | ||||||
}) | ||||||
} | ||||||
|
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.
One last change.
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.
@mrueg
<br> `restart_policy`=<Always>
right? i fixed
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.
The
Always
should be replaced by a placeholderThere 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.
@mrueg
i fixed