fix comment

This commit is contained in:
fengzixu 2022-01-11 14:28:31 +00:00
parent f96449f2e2
commit 5d544d3f01
3 changed files with 9 additions and 7 deletions

View File

@ -64,7 +64,7 @@ var (
volumeStatsHealthAbnormalDesc = metrics.NewDesc( volumeStatsHealthAbnormalDesc = metrics.NewDesc(
metrics.BuildFQName("", kubeletmetrics.KubeletSubsystem, kubeletmetrics.VolumeStatsHealthStatusKey), metrics.BuildFQName("", kubeletmetrics.KubeletSubsystem, kubeletmetrics.VolumeStatsHealthStatusKey),
"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. When volume_health_status is abnormal, 1 indicates the volume is unhealthy, 0 indicates volume is healthy",
[]string{"namespace", "persistentvolumeclaim", "volume_health_status"}, nil, []string{"namespace", "persistentvolumeclaim", "volume_health_status"}, nil,
metrics.ALPHA, "") metrics.ALPHA, "")
) )

View File

@ -47,7 +47,7 @@ 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] 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 [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
# TYPE kubelet_volume_stats_health_status gauge # TYPE kubelet_volume_stats_health_status gauge
` `

View File

@ -179,7 +179,6 @@ func (s *volumeStatCalculator) parsePodVolumeStats(podName string, pvcRef *stats
var ( var (
available, capacity, used, inodes, inodesFree, inodesUsed uint64 available, capacity, used, inodes, inodesFree, inodesUsed uint64
volumeStats stats.VolumeStats
) )
if metric.Available != nil { if metric.Available != nil {
@ -201,10 +200,13 @@ func (s *volumeStatCalculator) parsePodVolumeStats(podName string, pvcRef *stats
inodesUsed = uint64(metric.InodesUsed.Value()) inodesUsed = uint64(metric.InodesUsed.Value())
} }
volumeStats.FsStats = stats.FsStats{Time: metric.Time, AvailableBytes: &available, CapacityBytes: &capacity, volumeStats := stats.VolumeStats{
UsedBytes: &used, Inodes: &inodes, InodesFree: &inodesFree, InodesUsed: &inodesUsed} Name: podName,
volumeStats.Name = podName PVCRef: pvcRef,
volumeStats.PVCRef = pvcRef FsStats: stats.FsStats{Time: metric.Time, AvailableBytes: &available, CapacityBytes: &capacity,
UsedBytes: &used, Inodes: &inodes, InodesFree: &inodesFree, InodesUsed: &inodesUsed},
}
if metric.Abnormal != nil { if metric.Abnormal != nil {
volumeStats.VolumeHealthStats = &stats.VolumeHealthStats{ volumeStats.VolumeHealthStats = &stats.VolumeHealthStats{
Abnormal: *metric.Abnormal, Abnormal: *metric.Abnormal,