Skip to content

Commit

Permalink
pods: update init_cotainer_info metric
Browse files Browse the repository at this point in the history
  • Loading branch information
changhyuni committed Nov 19, 2023
1 parent 6d69935 commit 952ff6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/store/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ 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"}

for _, c := range p.Spec.InitContainers {
for _, cs := range p.Status.InitContainerStatuses {
Expand All @@ -686,7 +686,7 @@ func createPodInitContainerInfoFamilyGenerator() generator.FamilyGenerator {
}
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, c.RestartPolicy},
Value: 1,
})
}
Expand Down
1 change: 1 addition & 0 deletions internal/store/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func TestPodStore(t *testing.T) {
{
Name: "initContainer",
Image: "k8s.gcr.io/initfoo_spec",
RestartPolicy: v1.RestartPolicyAlways
},
},
},
Expand Down

0 comments on commit 952ff6b

Please sign in to comment.