mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
fix: correct metrics expression
This commit is contained in:
parent
d71e21e01e
commit
bab1755274
@ -63,7 +63,7 @@ var (
|
||||
)
|
||||
|
||||
volumeStatsHealthAbnormalDesc = metrics.NewDesc(
|
||||
metrics.BuildFQName("", kubeletmetrics.KubeletSubsystem, kubeletmetrics.VolumeStatsHealthAbnormalKey),
|
||||
metrics.BuildFQName("", kubeletmetrics.KubeletSubsystem, kubeletmetrics.VolumeStatsHealthStatusKey),
|
||||
"Volume health status. The count is either 1 or 0",
|
||||
[]string{"namespace", "persistentvolumeclaim"}, nil,
|
||||
metrics.ALPHA, "")
|
||||
@ -127,7 +127,7 @@ func (collector *volumeStatsCollector) CollectWithStability(ch chan<- metrics.Me
|
||||
addGauge(volumeStatsInodesDesc, pvcRef, float64(*volumeStat.Inodes))
|
||||
addGauge(volumeStatsInodesFreeDesc, pvcRef, float64(*volumeStat.InodesFree))
|
||||
addGauge(volumeStatsInodesUsedDesc, pvcRef, float64(*volumeStat.InodesUsed))
|
||||
addGauge(volumeStatsHealthAbnormalDesc, pvcRef, float64(convertBoolToFloat64(volumeStat.Abnormal)))
|
||||
addGauge(volumeStatsHealthAbnormalDesc, pvcRef, convertBoolToFloat64(volumeStat.Abnormal))
|
||||
allPVCs.Insert(pvcUniqStr)
|
||||
}
|
||||
}
|
||||
|
@ -47,8 +47,8 @@ func TestVolumeStatsCollector(t *testing.T) {
|
||||
# TYPE kubelet_volume_stats_inodes_used gauge
|
||||
# HELP kubelet_volume_stats_used_bytes [ALPHA] Number of used bytes in the volume
|
||||
# TYPE kubelet_volume_stats_used_bytes gauge
|
||||
# HELP kubelet_volume_stats_health_abnormal [ALPHA] Volume health status. The count is either 1 or 0
|
||||
# TYPE kubelet_volume_stats_health_abnormal gauge
|
||||
# HELP kubelet_volume_stats_health_status [ALPHA] Volume health status. The count is either 1 or 0
|
||||
# TYPE kubelet_volume_stats_health_status gauge
|
||||
`
|
||||
|
||||
var (
|
||||
@ -126,7 +126,7 @@ func TestVolumeStatsCollector(t *testing.T) {
|
||||
kubelet_volume_stats_inodes_free{namespace="testns",persistentvolumeclaim="testpvc"} 655344
|
||||
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_health_abnormal{namespace="testns",persistentvolumeclaim="testpvc"} 1
|
||||
kubelet_volume_stats_health_status{namespace="testns",persistentvolumeclaim="testpvc"} 1
|
||||
`
|
||||
|
||||
metrics = []string{
|
||||
@ -136,7 +136,7 @@ func TestVolumeStatsCollector(t *testing.T) {
|
||||
"kubelet_volume_stats_inodes_free",
|
||||
"kubelet_volume_stats_inodes_used",
|
||||
"kubelet_volume_stats_used_bytes",
|
||||
"kubelet_volume_stats_health_abnormal",
|
||||
"kubelet_volume_stats_health_status",
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -53,7 +53,7 @@ const (
|
||||
VolumeStatsInodesKey = "volume_stats_inodes"
|
||||
VolumeStatsInodesFreeKey = "volume_stats_inodes_free"
|
||||
VolumeStatsInodesUsedKey = "volume_stats_inodes_used"
|
||||
VolumeStatsHealthAbnormalKey = "volume_stats_health_abnormal"
|
||||
VolumeStatsHealthStatusKey = "volume_stats_health_status"
|
||||
RunningPodsKey = "running_pods"
|
||||
RunningContainersKey = "running_containers"
|
||||
// Metrics keys of remote runtime operations
|
||||
|
@ -230,6 +230,9 @@ var _ = SIGDescribe("Summary API [NodeConformance]", func() {
|
||||
"test-empty-dir": gstruct.MatchAllFields(gstruct.Fields{
|
||||
"Name": gomega.Equal("test-empty-dir"),
|
||||
"PVCRef": gomega.BeNil(),
|
||||
"VolumeHealthStats": gstruct.MatchAllFields(gstruct.Fields{
|
||||
"Abnormal": gomega.BeTrue(),
|
||||
}),
|
||||
"FsStats": gstruct.MatchAllFields(gstruct.Fields{
|
||||
"Time": recent(maxStatsAge),
|
||||
"AvailableBytes": fsCapacityBounds,
|
||||
|
Loading…
Reference in New Issue
Block a user