Skip to content
Merged
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
47 changes: 2 additions & 45 deletions pkg/cmd/roachtest/tests/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1881,14 +1881,8 @@ func runCDCMultiTablePTSBenchmark(

ct.waitForWorkload()

t.Status("workload finished, verifying metrics")

// These metrics are in nanoseconds, so we are asserting that both
// of these latency metrics are less than 25 milliseconds.
ct.verifyMetrics(ctx, ct.verifyMetricsUnderThreshold([]string{
"changefeed_stage_pts_manage_latency",
"changefeed_stage_pts_create_latency",
}, float64(30*time.Millisecond)))
// TODO(#154447): Send values of changefeed_stage_pts_manage_latency and
// changefeed_stage_pts_manage_error_latency metrics to RoachPerf.

t.Status("multi-table PTS benchmark finished")
}
Expand Down Expand Up @@ -4922,40 +4916,3 @@ func verifyMetricsNonZero(names ...string) func(metrics map[string]*prompb.Metri
return false
}
}

func (ct *cdcTester) verifyMetricsUnderThreshold(
names []string, threshold float64,
) func(metrics map[string]*prompb.MetricFamily) (ok bool) {
namesMap := make(map[string]struct{}, len(names))
for _, name := range names {
namesMap[name] = struct{}{}
}

return func(metrics map[string]*prompb.MetricFamily) (ok bool) {
found := map[string]struct{}{}

for name, fam := range metrics {
if _, ok := namesMap[name]; !ok {
continue
}

for _, m := range fam.Metric {
if m.Histogram.GetSampleCount() == 0 {
continue
}

observedValue := m.Histogram.GetSampleSum() / float64(m.Histogram.GetSampleCount())
if observedValue < threshold {
found[name] = struct{}{}
} else {
ct.t.Fatalf("observed value for metric %s over threshold. observedValue: %f, threshold: %f", name, observedValue, threshold)
}
}

if len(found) == len(names) {
return true
}
}
return false
}
}