Skip to content

Commit b162fb3

Browse files
Revert "Features/add tooltip to line chart" (#409)
Reverts #392 That PR was rebased without using the new data types in the refactor branch. Due to it breaking things, it makes most sense to revert it and later submit a new one for the feature.
1 parent fcc1114 commit b162fb3

File tree

7 files changed

+11
-89
lines changed

7 files changed

+11
-89
lines changed

src/guidellm/presentation/data_models.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
from pydantic import BaseModel, computed_field
77

8-
from guidellm.scheduler.strategy import SchedulingStrategy
9-
108
if TYPE_CHECKING:
119
from guidellm.benchmark import GenerativeBenchmark
1210

@@ -214,30 +212,12 @@ class BenchmarkDatum(BaseModel):
214212
ttft: TabularDistributionSummary
215213
throughput: TabularDistributionSummary
216214
time_per_request: TabularDistributionSummary
217-
strategy_display_str: str
218-
219-
@classmethod
220-
def get_strategy_display_str(cls, strategy: SchedulingStrategy):
221-
strategy_type = strategy if isinstance(strategy, str) else strategy.type_
222-
strategy_instance = (
223-
strategy if isinstance(strategy, SchedulingStrategy) else None
224-
)
225-
226-
if strategy_type == "concurrent":
227-
rate = f"@{strategy.streams}" if strategy_instance else "@##" # type: ignore[attr-defined]
228-
elif strategy_type in ("constant", "poisson"):
229-
rate = f"@{strategy.rate:.2f}" if strategy_instance else "@#.##" # type: ignore[attr-defined]
230-
else:
231-
rate = ""
232-
return f"{strategy_type}{rate}"
233215

234216
@classmethod
235217
def from_benchmark(cls, bm: "GenerativeBenchmark"):
236-
rps = bm.metrics.requests_per_second.successful.mean
237218
return cls(
238-
strategy_display_str=cls.get_strategy_display_str(bm.args.strategy),
239-
requests_per_second=rps,
240-
itl=TabularDistributionSummary.from_distribution_summary(
219+
requests_per_second=bm.metrics.requests_per_second.successful.mean,
220+
tpot=TabularDistributionSummary.from_distribution_summary(
241221
bm.metrics.inter_token_latency_ms.successful
242222
),
243223
ttft=TabularDistributionSummary.from_distribution_summary(

src/ui/lib/components/Charts/MetricLine/MetricLine.component.tsx

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { Typography, useTheme } from '@mui/material';
2-
import { PointTooltipProps, ResponsiveLine } from '@nivo/line';
3-
import { BasicTooltip } from '@nivo/tooltip';
1+
import { useTheme } from '@mui/material';
2+
import { ResponsiveLine } from '@nivo/line';
43
import React, { FC } from 'react';
54

65
import { useColor } from '@/lib/hooks/useColor';
@@ -50,30 +49,11 @@ export const Component: FC<MetricLineProps> = ({
5049
reverse: false,
5150
};
5251
}
53-
type PointTooltipPropsWithLabel = PointTooltipProps & {
54-
point: {
55-
data: {
56-
label: string;
57-
};
58-
};
59-
};
6052

6153
return (
6254
<ResponsiveLine
6355
curve="monotoneX"
6456
data={data}
65-
tooltip={(point) => (
66-
<BasicTooltip
67-
id={
68-
<Typography variant="body2">
69-
{(point as PointTooltipPropsWithLabel).point.data.label}
70-
</Typography>
71-
}
72-
color={point.point.color}
73-
enableChip={true}
74-
/>
75-
)}
76-
pointSize={10}
7757
colors={[selectedColor]}
7858
margin={{ top: 20, right: 10, bottom: 20, left: 35.5 }}
7959
xScale={{ type: 'linear', min: minX }}
@@ -112,6 +92,7 @@ export const Component: FC<MetricLineProps> = ({
11292
}}
11393
enableGridX={false}
11494
enableGridY={false}
95+
pointSize={0}
11596
useMesh={true}
11697
layers={[
11798
CustomAxes,
@@ -134,9 +115,6 @@ export const Component: FC<MetricLineProps> = ({
134115
),
135116
'axes',
136117
'lines',
137-
'points',
138-
'markers',
139-
'mesh',
140118
]}
141119
theme={lineTheme}
142120
/>

src/ui/lib/components/MetricsSummary/MetricsSummary.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const Component = () => {
102102
return (
103103
<>
104104
<BlockHeader label="Metrics Summary" />
105-
<MetricsSummaryContainer sx={{ overflow: 'visible' }} container>
105+
<MetricsSummaryContainer container>
106106
<HeaderLeftCell item xs={9}>
107107
<Box display="flex" flexDirection="row" justifyContent="space-between">
108108
<Typography variant="h6" color="surface.onSurface" mb={2}>

src/ui/lib/store/benchmarksWindowData.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export const benchmarksScript = `window.benchmarks = [
22
{
3-
strategyDisplayStr: "synchronous",
43
requestsPerSecond: 11.411616848282272,
54
tpot: {
65
mean: 8.758024845683707,
@@ -172,7 +171,6 @@ export const benchmarksScript = `window.benchmarks = [
172171
},
173172
},
174173
{
175-
strategyDisplayStr: "[email protected]",
176174
requestsPerSecond: 36.289181300710815,
177175
tpot: {
178176
mean: 588.0161376137819,
@@ -344,7 +342,6 @@ export const benchmarksScript = `window.benchmarks = [
344342
},
345343
},
346344
{
347-
strategyDisplayStr: "[email protected]",
348345
requestsPerSecond: 20.752070927855794,
349346
tpot: {
350347
mean: 116.28360712595156,
@@ -516,7 +513,6 @@ export const benchmarksScript = `window.benchmarks = [
516513
},
517514
},
518515
{
519-
strategyDisplayStr: "[email protected]",
520516
requestsPerSecond: 26.81917480361788,
521517
tpot: {
522518
mean: 299.7306064613554,
@@ -688,7 +684,6 @@ export const benchmarksScript = `window.benchmarks = [
688684
},
689685
},
690686
{
691-
strategyDisplayStr: "[email protected]",
692687
requestsPerSecond: 26.823988819498975,
693688
tpot: {
694689
mean: 683.8011571339198,
@@ -860,7 +855,6 @@ export const benchmarksScript = `window.benchmarks = [
860855
},
861856
},
862857
{
863-
strategyDisplayStr: "[email protected]",
864858
requestsPerSecond: 24.50047903792646,
865859
tpot: {
866860
mean: 742.9258901891964,
@@ -1032,7 +1026,6 @@ export const benchmarksScript = `window.benchmarks = [
10321026
},
10331027
},
10341028
{
1035-
strategyDisplayStr: "[email protected]",
10361029
requestsPerSecond: 25.617829792196602,
10371030
tpot: {
10381031
mean: 663.3098317044122,
@@ -1204,7 +1197,6 @@ export const benchmarksScript = `window.benchmarks = [
12041197
},
12051198
},
12061199
{
1207-
strategyDisplayStr: "[email protected]",
12081200
requestsPerSecond: 37.02892550982192,
12091201
tpot: {
12101202
mean: 606.4144710877113,
@@ -1376,7 +1368,6 @@ export const benchmarksScript = `window.benchmarks = [
13761368
},
13771369
},
13781370
{
1379-
strategyDisplayStr: "[email protected]",
13801371
requestsPerSecond: 37.29183354201869,
13811372
tpot: {
13821373
mean: 603.3237551205925,
@@ -1548,7 +1539,6 @@ export const benchmarksScript = `window.benchmarks = [
15481539
},
15491540
},
15501541
{
1551-
strategyDisplayStr: "throughput",
15521542
requestsPerSecond: 37.45318312972309,
15531543
tpot: {
15541544
mean: 600.7204526769262,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export interface BenchmarkMetrics {
2727

2828
export interface Benchmark extends BenchmarkMetrics {
2929
requestsPerSecond: number;
30-
strategyDisplayStr: string;
3130
}
3231

3332
export type Benchmarks = Benchmark[];

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

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,15 @@ 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-
2614
export const selectMetricsSummaryLineData = createSelector(
2715
[selectBenchmarks, selectSloState],
2816
(benchmarks, sloState) => {
2917
const sortedByRPS = benchmarks
3018
?.slice()
3119
?.sort((bm1, bm2) => (bm1.requestsPerSecond > bm2.requestsPerSecond ? 1 : -1));
3220
const selectedPercentile = sloState.enforcedPercentile;
33-
interface PointWithLabel extends Point {
34-
label: string;
35-
}
36-
const lineData: { [K in keyof BenchmarkMetrics]: PointWithLabel[] } = {
21+
22+
const lineData: { [K in keyof BenchmarkMetrics]: Point[] } = {
3723
ttft: [],
3824
tpot: [],
3925
timePerRequest: [],
@@ -46,17 +32,14 @@ export const selectMetricsSummaryLineData = createSelector(
4632
'throughput',
4733
];
4834
metrics.forEach((metric) => {
49-
const data: PointWithLabel[] = [];
35+
const data: Point[] = [];
5036
sortedByRPS?.forEach((benchmark) => {
5137
const percentile = benchmark[metric].percentileRows.find(
5238
(p) => p.percentile === selectedPercentile
5339
);
54-
const yValue = percentile?.value ?? 0;
55-
const units = getUnitsByMetric(metric);
5640
data.push({
5741
x: benchmark.requestsPerSecond,
58-
y: yValue,
59-
label: `${benchmark.strategyDisplayStr} ${formatNumber(yValue)} ${units}`,
42+
y: percentile?.value ?? 0,
6043
});
6144
});
6245

tests/unit/presentation/test_data_models.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
22

3-
from guidellm.presentation.data_models import BenchmarkDatum, Bucket
4-
from tests.unit.mock_benchmark import mock_generative_benchmark
3+
from guidellm.presentation.data_models import Bucket
54

65

76
@pytest.mark.smoke
@@ -19,10 +18,3 @@ def test_bucket_from_data():
1918
assert buckets[1].value == 8.0
2019
assert buckets[1].count == 5
2120
assert bucket_width == 1
22-
23-
24-
@pytest.mark.smoke
25-
def test_from_benchmark_includes_strategy_display_str():
26-
mock_bm = mock_generative_benchmark()
27-
bm = BenchmarkDatum.from_benchmark(mock_bm)
28-
assert bm.strategy_display_str == "synchronous"

0 commit comments

Comments
 (0)