change the volume health status metrics name

This commit is contained in:
fengzixu 2022-01-23 02:44:10 +00:00
parent 5d544d3f01
commit 9808ae48a0
3 changed files with 31 additions and 31 deletions

View File

@ -63,9 +63,9 @@ var (
) )
volumeStatsHealthAbnormalDesc = metrics.NewDesc( volumeStatsHealthAbnormalDesc = metrics.NewDesc(
metrics.BuildFQName("", kubeletmetrics.KubeletSubsystem, kubeletmetrics.VolumeStatsHealthStatusKey), metrics.BuildFQName("", kubeletmetrics.KubeletSubsystem, kubeletmetrics.VolumeStatsHealthStatusAbnormalKey),
"Abnormal volume health status. The count is either 1 or 0. When volume_health_status is abnormal, 1 indicates the volume is unhealthy, 0 indicates volume is healthy", "Abnormal volume health status. The count is either 1 or 0. 1 indicates the volume is unhealthy, 0 indicates volume is healthy",
[]string{"namespace", "persistentvolumeclaim", "volume_health_status"}, nil, []string{"namespace", "persistentvolumeclaim"}, nil,
metrics.ALPHA, "") metrics.ALPHA, "")
) )
@ -126,7 +126,7 @@ func (collector *volumeStatsCollector) CollectWithStability(ch chan<- metrics.Me
addGauge(volumeStatsInodesDesc, pvcRef, float64(*volumeStat.Inodes)) addGauge(volumeStatsInodesDesc, pvcRef, float64(*volumeStat.Inodes))
addGauge(volumeStatsInodesFreeDesc, pvcRef, float64(*volumeStat.InodesFree)) addGauge(volumeStatsInodesFreeDesc, pvcRef, float64(*volumeStat.InodesFree))
addGauge(volumeStatsInodesUsedDesc, pvcRef, float64(*volumeStat.InodesUsed)) addGauge(volumeStatsInodesUsedDesc, pvcRef, float64(*volumeStat.InodesUsed))
addGauge(volumeStatsHealthAbnormalDesc, pvcRef, convertBoolToFloat64(volumeStat.VolumeHealthStats.Abnormal), "abnormal") addGauge(volumeStatsHealthAbnormalDesc, pvcRef, convertBoolToFloat64(volumeStat.VolumeHealthStats.Abnormal))
allPVCs.Insert(pvcUniqStr) allPVCs.Insert(pvcUniqStr)
} }
} }

View File

@ -47,8 +47,8 @@ func TestVolumeStatsCollector(t *testing.T) {
# TYPE kubelet_volume_stats_inodes_used gauge # TYPE kubelet_volume_stats_inodes_used gauge
# HELP kubelet_volume_stats_used_bytes [ALPHA] Number of used bytes in the volume # HELP kubelet_volume_stats_used_bytes [ALPHA] Number of used bytes in the volume
# TYPE kubelet_volume_stats_used_bytes gauge # TYPE kubelet_volume_stats_used_bytes gauge
# HELP kubelet_volume_stats_health_status [ALPHA] Abnormal volume health status. The count is either 1 or 0. When volume_health_status is abnormal, 1 indicates the volume is unhealthy, 0 indicates volume is healthy # HELP kubelet_volume_stats_health_status_abnormal [ALPHA] Abnormal volume health status. The count is either 1 or 0. 1 indicates the volume is unhealthy, 0 indicates volume is healthy
# TYPE kubelet_volume_stats_health_status gauge # TYPE kubelet_volume_stats_health_status_abnormal gauge
` `
var ( var (
@ -126,7 +126,7 @@ func TestVolumeStatsCollector(t *testing.T) {
kubelet_volume_stats_inodes_free{namespace="testns",persistentvolumeclaim="testpvc"} 655344 kubelet_volume_stats_inodes_free{namespace="testns",persistentvolumeclaim="testpvc"} 655344
kubelet_volume_stats_inodes_used{namespace="testns",persistentvolumeclaim="testpvc"} 16 kubelet_volume_stats_inodes_used{namespace="testns",persistentvolumeclaim="testpvc"} 16
kubelet_volume_stats_used_bytes{namespace="testns",persistentvolumeclaim="testpvc"} 4.21789696e+09 kubelet_volume_stats_used_bytes{namespace="testns",persistentvolumeclaim="testpvc"} 4.21789696e+09
kubelet_volume_stats_health_status{namespace="testns",persistentvolumeclaim="testpvc",volume_health_status="abnormal"} 1 kubelet_volume_stats_health_status_abnormal{namespace="testns",persistentvolumeclaim="testpvc"} 1
` `
metrics = []string{ metrics = []string{
@ -136,7 +136,7 @@ func TestVolumeStatsCollector(t *testing.T) {
"kubelet_volume_stats_inodes_free", "kubelet_volume_stats_inodes_free",
"kubelet_volume_stats_inodes_used", "kubelet_volume_stats_inodes_used",
"kubelet_volume_stats_used_bytes", "kubelet_volume_stats_used_bytes",
"kubelet_volume_stats_health_status", "kubelet_volume_stats_health_status_abnormal",
} }
) )

View File

@ -53,7 +53,7 @@ const (
VolumeStatsInodesKey = "volume_stats_inodes" VolumeStatsInodesKey = "volume_stats_inodes"
VolumeStatsInodesFreeKey = "volume_stats_inodes_free" VolumeStatsInodesFreeKey = "volume_stats_inodes_free"
VolumeStatsInodesUsedKey = "volume_stats_inodes_used" VolumeStatsInodesUsedKey = "volume_stats_inodes_used"
VolumeStatsHealthStatusKey = "volume_stats_health_status" VolumeStatsHealthStatusAbnormalKey = "volume_stats_health_status_abnormal"
RunningPodsKey = "running_pods" RunningPodsKey = "running_pods"
RunningContainersKey = "running_containers" RunningContainersKey = "running_containers"
// Metrics keys of remote runtime operations // Metrics keys of remote runtime operations