Skip to content

Commit ab0de52

Browse files
committed
add metric value to tooltip
Signed-off-by: dalthecow <[email protected]>
1 parent fd2ac57 commit ab0de52

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/ui/lib/store/slices/benchmarks/benchmarks.selectors.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ import { selectSloState } from '../slo/slo.selectors';
1111

1212
export const selectBenchmarks = (state: RootState) => state.benchmarks.data;
1313

14+
const getUnitsByMetric = (metric: string) => {
15+
switch (metric) {
16+
case 'ttft':
17+
case 'tpot':
18+
return 'ms';
19+
case 'timePerRequest':
20+
return 'sec';
21+
case 'throughput':
22+
return 'tok/s';
23+
}
24+
};
25+
1426
export const selectMetricsSummaryLineData = createSelector(
1527
[selectBenchmarks, selectSloState],
1628
(benchmarks, sloState) => {
@@ -39,10 +51,12 @@ export const selectMetricsSummaryLineData = createSelector(
3951
const percentile = benchmark[metric].percentileRows.find(
4052
(p) => p.percentile === selectedPercentile
4153
);
54+
const yValue = percentile?.value ?? 0;
55+
const units = getUnitsByMetric(metric);
4256
data.push({
4357
x: benchmark.requestsPerSecond,
44-
y: percentile?.value ?? 0,
45-
label: benchmark.strategyDisplayStr,
58+
y: yValue,
59+
label: `${benchmark.strategyDisplayStr} ${yValue} ${units}`,
4660
});
4761
});
4862

0 commit comments

Comments
 (0)