Skip to content

Commit

Permalink
add a label to record node name
Browse files Browse the repository at this point in the history
  • Loading branch information
XuZhenxue committed Jul 16, 2024
1 parent 41f82cb commit 8ec21b3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions test/e2e/metriconly/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var _ = ginkgo.Describe("NPD should export Prometheus metrics.", func() {
gotMetrics, err := npd.FetchNPDMetrics(instance)
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Error fetching NPD metrics: %v", err))

assertMetricExist(gotMetrics, "cpu_runnable_task_count", map[string]string{}, true)
assertMetricExist(gotMetrics, "cpu_runnable_task_count", map[string]string{}, false)
assertMetricExist(gotMetrics, "cpu_usage_time", map[string]string{}, false)
assertMetricExist(gotMetrics, "cpu_load_1m", map[string]string{}, false)
assertMetricExist(gotMetrics, "cpu_load_5m", map[string]string{}, false)
Expand Down Expand Up @@ -103,19 +103,19 @@ var _ = ginkgo.Describe("NPD should export Prometheus metrics.", func() {
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Expect NPD to become ready in 120s, but hit error: %v", err))

assertMetricValueInBound(instance,
"problem_gauge", map[string]string{"reason": "DockerHung", "type": "KernelDeadlock"},
"problem_gauge", map[string]string{"reason": "DockerHung", "type": "KernelDeadlock", "node": instance.Name},
0.0, 0.0)
assertMetricValueInBound(instance,
"problem_counter", map[string]string{"reason": "DockerHung"},
"problem_counter", map[string]string{"reason": "DockerHung", "node": instance.Name},
0.0, 0.0)
assertMetricValueInBound(instance,
"problem_counter", map[string]string{"reason": "FilesystemIsReadOnly"},
"problem_counter", map[string]string{"reason": "FilesystemIsReadOnly", "node": instance.Name},
0.0, 0.0)
assertMetricValueInBound(instance,
"problem_counter", map[string]string{"reason": "KernelOops"},
"problem_counter", map[string]string{"reason": "KernelOops", "node": instance.Name},
0.0, 0.0)
assertMetricValueInBound(instance,
"problem_counter", map[string]string{"reason": "OOMKilling"},
"problem_counter", map[string]string{"reason": "OOMKilling", "node": instance.Name},
0.0, 0.0)
})
})
Expand All @@ -132,10 +132,10 @@ var _ = ginkgo.Describe("NPD should export Prometheus metrics.", func() {
ginkgo.It("NPD should update problem_counter{reason:Ext4Error} and problem_gauge{type:ReadonlyFilesystem}", func() {
time.Sleep(5 * time.Second)
assertMetricValueAtLeast(instance,
"problem_counter", map[string]string{"reason": "Ext4Error"},
"problem_counter", map[string]string{"reason": "Ext4Error", "node": instance.Name},
1.0)
assertMetricValueInBound(instance,
"problem_gauge", map[string]string{"reason": "FilesystemIsReadOnly", "type": "ReadonlyFilesystem"},
"problem_gauge", map[string]string{"reason": "FilesystemIsReadOnly", "type": "ReadonlyFilesystem", "node": instance.Name},
1.0, 1.0)
})

Expand All @@ -158,16 +158,16 @@ var _ = ginkgo.Describe("NPD should export Prometheus metrics.", func() {
ginkgo.It("NPD should update problem_counter and problem_gauge", func() {
time.Sleep(5 * time.Second)
assertMetricValueInBound(instance,
"problem_counter", map[string]string{"reason": "DockerHung"},
"problem_counter", map[string]string{"reason": "DockerHung", "node": instance.Name},
1.0, 1.0)
assertMetricValueInBound(instance,
"problem_counter", map[string]string{"reason": "TaskHung"},
"problem_counter", map[string]string{"reason": "TaskHung", "node": instance.Name},
1.0, 1.0)
assertMetricValueInBound(instance,
"problem_gauge", map[string]string{"reason": "DockerHung", "type": "KernelDeadlock"},
"problem_gauge", map[string]string{"reason": "DockerHung", "type": "KernelDeadlock", "node": instance.Name},
1.0, 1.0)
assertMetricValueInBound(instance,
"problem_counter", map[string]string{"reason": "OOMKilling"},
"problem_counter", map[string]string{"reason": "OOMKilling", "node": instance.Name},
1.0, 1.0)
})
})
Expand Down

0 comments on commit 8ec21b3

Please sign in to comment.