Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixing non-exported flexgroup instances error #2980

Merged
merged 1 commit into from
Jun 11, 2024
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
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