Skip to content

Commit 4b8bfa8

Browse files
craig[bot]csgourav
andcommitted
Merge #144218
144218: roachtest/allocbench: Add labels to the std-dev metric r=sambhav-jain-16 a=csgourav Adds unit and is_higher_better tags to std-dev metrics being emitted from allocbench tests. Adds code for aggregate value generation in cdc/scan test. Adds missing unit label for tpcc test. Epic: none Fixes: none Co-authored-by: Gourav Kumar <[email protected]>
2 parents 4edcea6 + 16ddb97 commit 4b8bfa8

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

pkg/cmd/roachtest/tests/allocation_bench.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,20 @@ func runAllocationBench(
351351
// worst/best case outcomes.
352352
result, sampleStddev := findMinDistanceClusterStatRun(t, samples)
353353
for tag, value := range sampleStddev {
354-
result.Total[fmt.Sprintf("std_%s", tag)] = value
354+
metricName := fmt.Sprintf("std_%s", tag)
355+
result.Total[metricName] = value
356+
357+
// Populate BenchmarkMetrics with metadata if it's initialized
358+
// (it will be initialized only when OpenMetrics is enabled)
359+
if result.BenchmarkMetrics != nil {
360+
result.BenchmarkMetrics[metricName] = roachtestutil.AggregatedMetric{
361+
Name: metricName,
362+
Value: roachtestutil.MetricPoint(value),
363+
Unit: "stddev",
364+
IsHigherBetter: false, // Lower standard deviation is better
365+
AdditionalLabels: nil,
366+
}
367+
}
355368
}
356369
if result == nil {
357370
t.L().PrintfCtx(ctx, "no samples found for allocation bench run, won't put any artifacts")

pkg/cmd/roachtest/tests/cdc_bench.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,26 @@ func registerCDCBench(r registry.Registry) {
9292
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {
9393
runCDCBenchScan(ctx, t, c, scanType, rows, ranges, format)
9494
},
95+
PostProcessPerfMetrics: func(testName string, histograms *roachtestutil.HistogramMetric) (roachtestutil.AggregatedPerfMetrics, error) {
96+
metrics := roachtestutil.AggregatedPerfMetrics{}
97+
98+
// Find the scan-rate summary
99+
var scanRate float64
100+
if len(histograms.Summaries) != 1 {
101+
return nil, errors.Errorf("expected exactly 1 histogram summary, got %d", len(histograms.Summaries))
102+
}
103+
scanRate = float64(histograms.Summaries[0].HighestTrackableValue) / float64(time.Second)
104+
105+
// Add scan rate metric (higher is better)
106+
metrics = append(metrics, &roachtestutil.AggregatedMetric{
107+
Name: "scan_rate",
108+
Value: roachtestutil.MetricPoint(scanRate),
109+
Unit: "rows/s",
110+
IsHigherBetter: true,
111+
})
112+
113+
return metrics, nil
114+
},
95115
})
96116
}
97117
}

pkg/cmd/roachtest/tests/tpcc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func getMaxWarehousesAboveEfficiency(
163163
aggregatedMetrics = append(aggregatedMetrics, &roachtestutil.AggregatedMetric{
164164
Name: fmt.Sprintf("%s_max_warehouse", testName),
165165
Value: roachtestutil.MetricPoint(maxEfficientWarehouse),
166-
Unit: "",
166+
Unit: "warehouses",
167167
IsHigherBetter: true,
168168
// labels added here override any labels imported from the stats file.
169169
// since we don't want to specify a warehouse label for this metric, we pass an empty label.

0 commit comments

Comments
 (0)