Skip to content

Commit

Permalink
modify labels key
Browse files Browse the repository at this point in the history
modify label key
  • Loading branch information
changhyuni committed Dec 15, 2023
1 parent ed1a7f9 commit b948807
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion 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", "type"}
labelKeys := []string{"container", "image_spec", "image", "image_id", "container_id", "restart_policy"}

for _, c := range p.Spec.InitContainers {
restartPolicy := ""
Expand Down
6 changes: 3 additions & 3 deletions internal/store/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ func TestPodStore(t *testing.T) {
},
InitContainers: []v1.Container{
{
Name: "initContainer",
Image: "k8s.gcr.io/initfoo_spec",
Name: "initContainer",
Image: "k8s.gcr.io/initfoo_spec",
RestartPolicy: &restartPolicyAlways,
},
},
Expand Down Expand Up @@ -126,7 +126,7 @@ func TestPodStore(t *testing.T) {
# TYPE kube_pod_init_container_info gauge
kube_pod_container_info{container="container2",container_id="docker://cd456",image_spec="k8s.gcr.io/hyperkube2_spec",image="k8s.gcr.io/hyperkube2",image_id="docker://sha256:bbb",namespace="ns2",pod="pod2",uid="uid2"} 1
kube_pod_container_info{container="container3",container_id="docker://ef789",image_spec="k8s.gcr.io/hyperkube3_spec",image="k8s.gcr.io/hyperkube3",image_id="docker://sha256:ccc",namespace="ns2",pod="pod2",uid="uid2"} 1
kube_pod_init_container_info{container="initContainer",container_id="docker://ef123",image_spec="k8s.gcr.io/initfoo_spec",image="k8s.gcr.io/initfoo",image_id="docker://sha256:wxyz",namespace="ns2",pod="pod2",uid="uid2",type="Always"} 1`,
kube_pod_init_container_info{container="initContainer",container_id="docker://ef123",image_spec="k8s.gcr.io/initfoo_spec",image="k8s.gcr.io/initfoo",image_id="docker://sha256:wxyz",namespace="ns2",pod="pod2",uid="uid2",restart_policy="Always"} 1`,
MetricNames: []string{"kube_pod_container_info", "kube_pod_init_container_info"},
},
{
Expand Down

0 comments on commit b948807

Please sign in to comment.