Skip to content

Commit

Permalink
fix: using instanceName instead of volName in fabricpool perf
Browse files Browse the repository at this point in the history
  • Loading branch information
Hardikl committed Sep 25, 2024
1 parent 1ff7e71 commit 33f7381
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
23 changes: 19 additions & 4 deletions cmd/collectors/fabricpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import (
"github.com/netapp/harvest/v2/pkg/matrix"
"log/slog"
"maps"
"regexp"
"strings"
)

var fabricpoolRegex = regexp.MustCompile(`^(.*)__(\d{4})_bin.*$`)

func GetFlexGroupFabricPoolMetrics(dataMap map[string]*matrix.Matrix, object string, opName string, includeConstituents bool, l *slog.Logger) (*matrix.Matrix, error) {
var (
err error
Expand All @@ -31,8 +34,9 @@ func GetFlexGroupFabricPoolMetrics(dataMap map[string]*matrix.Matrix, object str
if !i.IsExportable() {
continue
}
if match := flexgroupRegex.FindStringSubmatch(i.GetLabel("volume")); len(match) == 3 {
key := i.GetLabel("svm") + "." + match[1] + i.GetLabel("cloud_target")

if match := fabricpoolRegex.FindStringSubmatch(fetchVolumeName(i)); len(match) == 3 {
key := i.GetLabel("svm") + "." + match[1] + "." + i.GetLabel("cloud_target")
if cache.GetInstance(key) == nil {
fg, _ := cache.NewInstance(key)
fg.SetLabels(maps.Clone(i.GetLabels()))
Expand All @@ -46,9 +50,9 @@ func GetFlexGroupFabricPoolMetrics(dataMap map[string]*matrix.Matrix, object str

// create summary
for _, i := range data.GetInstances() {
if match := flexgroupRegex.FindStringSubmatch(i.GetLabel("volume")); len(match) == 3 {
if match := fabricpoolRegex.FindStringSubmatch(fetchVolumeName(i)); len(match) == 3 {
// instance key is svm.flexgroup-volume.cloud-target-name
key := i.GetLabel("svm") + "." + match[1] + i.GetLabel("cloud_target")
key := i.GetLabel("svm") + "." + match[1] + "." + i.GetLabel("cloud_target")

fg := cache.GetInstance(key)
if fg == nil {
Expand Down Expand Up @@ -143,3 +147,14 @@ func GetFlexGroupFabricPoolMetrics(dataMap map[string]*matrix.Matrix, object str
}
return cache, nil
}

func fetchVolumeName(i *matrix.Instance) string {
// zapiperf name: test1_fg2__0001_bin_0_cfg_id_0
// restperf name: test1_fg2__0002_bin_1_cfg_id_1
instanceName := i.GetLabel("fabricpool")
compAggrName := i.GetLabel("comp_aggr_name")
if names := strings.Split(instanceName, compAggrName+"_"); len(names) == 2 {
return names[1]
}
return ""
}
4 changes: 4 additions & 0 deletions conf/restperf/9.12.0/wafl_comp_aggr_vol_bin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ object: fabricpool

counters:
- ^^id
- ^aggregate.name => comp_aggr_name
- ^cloud_target.name => cloud_target
- ^svm.name => svm
- ^volume.name => volume
- cloud_bin_op => cloud_bin_operation
- cloud_bin_op_latency_average

plugins:
- LabelAgent:
split:
- id `:` ,fabricpool
- FabricPool:
- include_constituents: false

Expand Down
1 change: 1 addition & 0 deletions conf/zapiperf/cdot/9.8.0/wafl_comp_aggr_vol_bin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ instance_key: uuid
counters:
- cloud_bin_op_latency_average
- cloud_bin_operation
- comp_aggr_name
- instance_name
- object_store_name => cloud_target
- vol_name => volume
Expand Down

0 comments on commit 33f7381

Please sign in to comment.