Skip to content

Commit

Permalink
style: remove potential nil dereference (#2675)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgrinds committed Feb 16, 2024
1 parent 503b460 commit 220703f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/collectors/rest/plugins/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ func (v *Volume) updateVolumeLabels(data *matrix.Matrix, volumeMap map[string]vo
cloneSplitEstimateMetric := data.GetMetric("clone_split_estimate")
if cloneSplitEstimateMetric == nil {
if cloneSplitEstimateMetric, err = data.NewMetricFloat64("clone_split_estimate"); err != nil {
v.Logger.Error().Stack().Msg("error while creating clone split estimate metric")
v.Logger.Error().Err(err).Msg("error while creating clone split estimate metric")
return
}
}
for _, volume := range data.GetInstances() {
Expand Down Expand Up @@ -168,7 +169,7 @@ func (v *Volume) handleARWProtection(data *matrix.Matrix) {
// Set all global labels
v.arw.SetGlobalLabels(data.GetGlobalLabels())
arwStatusValue := "Active Mode"
// Case where cluster don't have any volumes, arwStatus show as 'Not Monitoring'
// Case where cluster doesn't have any volumes, arwStatus show as 'Not Monitoring'
if len(data.GetInstances()) == 0 {
arwStatusValue = "Not Monitoring"
}
Expand Down

0 comments on commit 220703f

Please sign in to comment.