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

perf: RestPerf collectors should only run PollInstance for workloads #3207

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 9 additions & 10 deletions cmd/collectors/restperf/restperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,11 +687,6 @@ func (r *RestPerf) PollData() (map[string]*matrix.Matrix, error) {
startTime time.Time
)

mat := r.Matrix[r.Object]
if len(mat.GetInstances()) == 0 {
return nil, errs.New(errs.ErrNoInstance, "no "+r.Object+" instances fetched in PollInstance")
}

timestamp := r.Matrix[r.Object].GetMetric(timestampMetricName)
if timestamp == nil {
return nil, errs.New(errs.ErrConfig, "missing timestamp metric")
Expand All @@ -703,7 +698,7 @@ func (r *RestPerf) PollData() (map[string]*matrix.Matrix, error) {
dataQuery := path.Join(r.Prop.Query, "rows")

var filter []string
// Sort filters so that the href is deterministic
// Sort metrics so that the href is deterministic
metrics := slices.Sorted(maps.Keys(r.Prop.Metrics))

filter = append(filter, "counters.name="+strings.Join(metrics, "|"))
Expand Down Expand Up @@ -870,10 +865,14 @@ func (r *RestPerf) pollData(startTime time.Time, perfRecords []rest.PerfRecord)

instance = curMat.GetInstance(instanceKey)
if instance == nil {
if !isWorkloadObject(r.Prop.Query) && !isWorkloadDetailObject(r.Prop.Query) {
r.Logger.Warn("Skip instanceKey, not found in cache", slog.String("instanceKey", instanceKey))
if isWorkloadObject(r.Prop.Query) || isWorkloadDetailObject(r.Prop.Query) {
return true
}
instance, err = curMat.NewInstance(instanceKey)
cgrinds marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
r.Logger.Error("add instance", slogx.Err(err), slog.String("instanceKey", instanceKey))
return true
}
return true
}

// check for partial aggregation
Expand Down Expand Up @@ -1252,7 +1251,7 @@ func (r *RestPerf) pollData(startTime time.Time, perfRecords []rest.PerfRecord)
}
continue
}
// If we reach here then one of the earlier clauses should have executed `continue` statement
// If we reach here, then one of the earlier clauses should have executed `continue` statement
r.Logger.Error(
"Unknown property",
slog.String("key", key),
Expand Down
1 change: 1 addition & 0 deletions conf/restperf/9.12.0/workload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ object: qos
client_timeout: 1m30s

schedule:
- instance: 10m
- data: 3m

counters:
Expand Down
1 change: 1 addition & 0 deletions conf/restperf/9.12.0/workload_detail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ object: qos_detail
client_timeout: 1m30s

schedule:
- instance: 10m
- data: 3m

counters:
Expand Down
1 change: 1 addition & 0 deletions conf/restperf/9.12.0/workload_detail_volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ object: qos_detail
client_timeout: 1m30s

schedule:
- instance: 10m
- data: 3m

counters:
Expand Down
1 change: 1 addition & 0 deletions conf/restperf/9.12.0/workload_volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ object: qos
client_timeout: 1m30s

schedule:
- instance: 10m
- data: 3m

counters:
Expand Down
1 change: 0 additions & 1 deletion conf/restperf/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ collector: RestPerf
# Order here matters!
schedule:
- counter: 24h
- instance: 10m
- data: 1m

objects:
Expand Down