Skip to content

Commit

Permalink
fix: fixing non-exported flexgroup instances error
Browse files Browse the repository at this point in the history
  • Loading branch information
Hardikl authored and cgrinds committed Jun 11, 2024
1 parent 4ac3a52 commit d6d0f54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 31 deletions.
18 changes: 3 additions & 15 deletions cmd/collectors/restperf/plugins/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util

fgAggrMap := make(map[string]*set.Set)
flexgroupAggrsMap := make(map[string]*set.Set)
nonExportedInstanceMap := make(map[string]bool)

// volume_aggr_labels metric is deprecated now and will be removed later.
metricName := "labels"
Expand All @@ -69,11 +68,7 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
cache.UUID += ".Volume"

// create flexgroup instance cache
for iKey, i := range data.GetInstances() {
if !i.IsExportable() {
nonExportedInstanceMap[iKey] = true
continue
}
for _, i := range data.GetInstances() {
if match := re.FindStringSubmatch(i.GetLabel("volume")); len(match) == 3 {
// instance key is svm.flexgroup-volume
key := i.GetLabel("svm") + "." + match[1]
Expand Down Expand Up @@ -102,10 +97,7 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
fgAggrMap[key].Add(i.GetLabel("aggr"))
flexgroupAggrsMap[key].Add(i.GetLabel("aggr"))
i.SetLabel(style, "flexgroup_constituent")
if !v.includeConstituents {
i.SetExportable(false)
nonExportedInstanceMap[iKey] = true
}
i.SetExportable(v.includeConstituents)
} else {
i.SetLabel(style, "flexvol")
key := i.GetLabel("svm") + "." + i.GetLabel("volume")
Expand All @@ -127,11 +119,7 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
// cache.Reset()

// create summary
for iKey, i := range data.GetInstances() {
if nonExportedInstanceMap[iKey] {
continue
}

for _, i := range data.GetInstances() {
match := re.FindStringSubmatch(i.GetLabel("volume"))
if len(match) != 3 {
continue
Expand Down
19 changes: 3 additions & 16 deletions cmd/collectors/zapiperf/plugins/volume/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util

fgAggrMap := make(map[string]*set.Set)
flexgroupAggrsMap := make(map[string]*set.Set)
nonExportedInstanceMap := make(map[string]bool)

// volume_aggr_labels metric is deprecated now and will be removed later.
metricName := "labels"
Expand All @@ -77,11 +76,7 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
cache.UUID += ".Volume"

// create flexgroup instance cache
for iKey, i := range data.GetInstances() {
if !i.IsExportable() {
nonExportedInstanceMap[iKey] = true
continue
}
for _, i := range data.GetInstances() {
if match := re.FindStringSubmatch(i.GetLabel("volume")); len(match) == 3 {
// instance key is svm.flexgroup-volume
key := i.GetLabel("svm") + "." + match[1]
Expand Down Expand Up @@ -110,10 +105,7 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
fgAggrMap[key].Add(i.GetLabel("aggr"))
flexgroupAggrsMap[key].Add(i.GetLabel("aggr"))
i.SetLabel(style, "flexgroup_constituent")
if !v.includeConstituents {
i.SetExportable(false)
nonExportedInstanceMap[iKey] = true
}
i.SetExportable(v.includeConstituents)
} else {
i.SetLabel(style, "flexvol")
key := i.GetLabel("svm") + "." + i.GetLabel("volume")
Expand All @@ -128,19 +120,14 @@ func (v *Volume) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, *util
v.Logger.Error().Err(err).Str("metric", metricName).Msg("Unable to set value on metric")
}
}

}

v.Logger.Debug().Msgf("extracted %d flexgroup volumes", len(cache.GetInstances()))

// cache.Reset()

// create summary
for iKey, i := range data.GetInstances() {
if nonExportedInstanceMap[iKey] {
continue
}

for _, i := range data.GetInstances() {
match := re.FindStringSubmatch(i.GetLabel("volume"))
if len(match) != 3 {
continue
Expand Down

0 comments on commit d6d0f54

Please sign in to comment.