Skip to content

Commit

Permalink
Update two metrics name to make promlint happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
RainbowMango committed Jun 23, 2020
1 parent 981f675 commit 168c695
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions pkg/kubelet/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ var (
RunningPodCount = metrics.NewGauge(
&metrics.GaugeOpts{
Subsystem: KubeletSubsystem,
Name: "running_pod_count",
Name: "running_pods",
Help: "Number of pods currently running",
StabilityLevel: metrics.ALPHA,
},
Expand All @@ -358,7 +358,7 @@ var (
RunningContainerCount = metrics.NewGaugeVec(
&metrics.GaugeOpts{
Subsystem: KubeletSubsystem,
Name: "running_container_count",
Name: "running_containers",
Help: "Number of containers currently running",
StabilityLevel: metrics.ALPHA,
},
Expand Down
20 changes: 10 additions & 10 deletions pkg/kubelet/pleg/generic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,22 +682,22 @@ func TestRunningPodAndContainerCount(t *testing.T) {
}{
{
name: "test container count",
metricsName: "kubelet_running_container_count",
metricsName: "kubelet_running_containers",
wants: `
# HELP kubelet_running_container_count [ALPHA] Number of containers currently running
# TYPE kubelet_running_container_count gauge
kubelet_running_container_count{container_state="exited"} 1
kubelet_running_container_count{container_state="running"} 1
kubelet_running_container_count{container_state="unknown"} 2
# HELP kubelet_running_containers [ALPHA] Number of containers currently running
# TYPE kubelet_running_containers gauge
kubelet_running_containers{container_state="exited"} 1
kubelet_running_containers{container_state="running"} 1
kubelet_running_containers{container_state="unknown"} 2
`,
},
{
name: "test pod count",
metricsName: "kubelet_running_pod_count",
metricsName: "kubelet_running_pods",
wants: `
# HELP kubelet_running_pod_count [ALPHA] Number of pods currently running
# TYPE kubelet_running_pod_count gauge
kubelet_running_pod_count 2
# HELP kubelet_running_pods [ALPHA] Number of pods currently running
# TYPE kubelet_running_pods gauge
kubelet_running_pods 2
`,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,9 @@ var exceptionMetrics = []string{
"node_collector_evictions_number",

// k8s.io/kubernetes/pkg/kubelet/server/stats
// The two metrics have been deprecated and will be removed in release v1.20+.
"container_cpu_usage_seconds_total", // non-counter metrics should not have "_total" suffix
"node_cpu_usage_seconds_total", // non-counter metrics should not have "_total" suffix

// k8s.io/kubernetes/pkg/kubelet/pleg
"kubelet_running_container_count", // non-histogram and non-summary metrics should not have "_count" suffix
"kubelet_running_pod_count", // non-histogram and non-summary metrics should not have "_count" suffix
}

// A Problem is an issue detected by a Linter.
Expand Down

0 comments on commit 168c695

Please sign in to comment.