@@ -374,6 +374,27 @@ type openmetricsValues struct {
374374 Time int64
375375}
376376
377+ // Define units for sysbench metrics
378+ var units = map [string ]string {
379+ // Transaction rates - operations per second
380+ "transactions" : "unit=\" ops/sec\" ,is_higher_better=\" true\" " ,
381+
382+ // Query rates - queries per second
383+ "qps" : "unit=\" qps\" ,is_higher_better=\" true\" " ,
384+ "read_qps" : "unit=\" qps\" ,is_higher_better=\" true\" " ,
385+ "write_qps" : "unit=\" qps\" ,is_higher_better=\" true\" " ,
386+ "other_qps" : "unit=\" qps\" ,is_higher_better=\" true\" " ,
387+
388+ // Latency - milliseconds
389+ "p95_latency" : "unit=\" ms\" ,is_higher_better=\" false\" " ,
390+
391+ // Error rates - errors per second
392+ "errors" : "unit=\" errors/sec\" ,is_higher_better=\" false\" " ,
393+
394+ // Reconnection rates - reconnects per second
395+ "reconnects" : "unit=\" reconnects/sec\" ,is_higher_better=\" false\" " ,
396+ }
397+
377398// exportSysbenchResults parses the output of `sysbench` into a stats
378399// file and writes it to the perf directory that roachperf expects. The
379400// format of the stats file is dependent on t.ExportOpenmetrics().
@@ -495,7 +516,6 @@ func addCurrentSnapshotToOpenmetrics(
495516 metrics sysbenchMetrics , openmetricsMap map [string ][]openmetricsValues ,
496517) {
497518 time := metrics .Time
498- openmetricsMap ["threads" ] = append (openmetricsMap ["threads" ], openmetricsValues {Value : metrics .Threads , Time : time })
499519 openmetricsMap ["transactions" ] = append (openmetricsMap ["transactions" ], openmetricsValues {Value : metrics .Transactions , Time : time })
500520 openmetricsMap ["qps" ] = append (openmetricsMap ["qps" ], openmetricsValues {Value : metrics .Qps , Time : time })
501521 openmetricsMap ["read_qps" ] = append (openmetricsMap ["read_qps" ], openmetricsValues {Value : metrics .ReadQps , Time : time })
@@ -513,7 +533,12 @@ func getOpenmetricsBytes(openmetricsMap map[string][]openmetricsValues, labelStr
513533 metricName := util .SanitizeMetricName (key )
514534 metricsBuf .WriteString (roachtestutil .GetOpenmetricsGaugeType (metricName ))
515535 for _ , value := range values {
516- metricsBuf .WriteString (fmt .Sprintf ("%s{%s} %s %d\n " , metricName , labelString , value .Value , value .Time ))
536+ metricsBuf .WriteString (fmt .Sprintf ("%s{%s,%s} %s %d\n " ,
537+ metricName ,
538+ labelString ,
539+ units [key ],
540+ value .Value ,
541+ value .Time ))
517542 }
518543 }
519544
0 commit comments