Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions cmd/collectors/rest/plugins/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,13 @@ func (v *Volume) updateVolumeLabels(data *matrix.Matrix, volumeMap map[string]vo

capacityTierFootprintMetric := data.GetMetric("volume_blocks_footprint_bin1")
totalFootprintMetric := data.GetMetric("total_footprint")

hotDataMetric := data.GetMetric("hot_data")
if hotDataMetric == nil {
if hotDataMetric, err = data.NewMetricFloat64("hot_data"); err != nil {
v.SLogger.Error("error while creating hot data metric", slogx.Err(err))
return
if capacityTierFootprintMetric != nil && totalFootprintMetric != nil {
if hotDataMetric == nil {
if hotDataMetric, err = data.NewMetricFloat64("hot_data"); err != nil {
v.SLogger.Error("error while creating hot data metric", slogx.Err(err))
return
}
}
}

Expand Down Expand Up @@ -227,7 +228,7 @@ func (v *Volume) updateVolumeLabels(data *matrix.Matrix, volumeMap map[string]vo
}

// Calculate Hot data metric, where hot data = total footprint - cold data
if capacityTierFootprintMetric != nil {
if capacityTierFootprintMetric != nil && totalFootprintMetric != nil {
if capacityTierFootprintMetricValue, exist := capacityTierFootprintMetric.GetValueFloat64(volume); exist {
totalFootprintMetricValue, _ := totalFootprintMetric.GetValueFloat64(volume)
hotDataMetric.SetValueFloat64(volume, totalFootprintMetricValue-capacityTierFootprintMetricValue)
Expand Down
10 changes: 6 additions & 4 deletions cmd/collectors/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,11 @@ func ProcessFlexGroupFootPrint(data *matrix.Matrix, logger *slog.Logger) *matrix

totalFootprintMetric := cache.GetMetric("total_footprint")
hotDataMetric := cache.GetMetric("hot_data")
if hotDataMetric == nil {
if hotDataMetric, err = cache.NewMetricFloat64("hot_data"); err != nil {
logger.Error("error while creating hot data metric", slogx.Err(err))
if capacityTierFootprintMetric != nil && totalFootprintMetric != nil {
if hotDataMetric == nil {
if hotDataMetric, err = cache.NewMetricFloat64("hot_data"); err != nil {
logger.Error("error while creating hot data metric", slogx.Err(err))
}
}
}

Expand Down Expand Up @@ -324,7 +326,7 @@ func ProcessFlexGroupFootPrint(data *matrix.Matrix, logger *slog.Logger) *matrix
}

// Calculate Hot data metric, where hot data = total footprint - cold data
if capacityTierFootprintMetric != nil {
if capacityTierFootprintMetric != nil && totalFootprintMetric != nil {
if capacityTierFootprintMetricValue, exist := capacityTierFootprintMetric.GetValueFloat64(fg); exist {
totalFootprintMetricValue, _ := totalFootprintMetric.GetValueFloat64(fg)
hotDataMetric.SetValueFloat64(fg, totalFootprintMetricValue-capacityTierFootprintMetricValue)
Expand Down
2 changes: 1 addition & 1 deletion cmd/collectors/zapi/plugins/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func (v *Volume) getVolumeFootprint() (map[string]map[string]string, error) {
footprintMetrics["guarantee_footprint"] = volumeBlocksFootprint

// Calculate Hot data metric, where hot data = total footprint - cold data
if capacityTierFootprint != "" {
if capacityTierFootprint != "" && totalFootprint != "" {
totalFootprintVal, _ := strconv.ParseFloat(totalFootprint, 64)
capacityTierFootprintVal, _ := strconv.ParseFloat(capacityTierFootprint, 64)
footprintMetrics["hot_data"] = strconv.FormatFloat(totalFootprintVal-capacityTierFootprintVal, 'f', -1, 64)
Expand Down
Loading