Skip to content

Commit 58f0bbc

Browse files
mjqclaude
andcommitted
ref(performance): Match EAP duration breakdown chart to regular version
Switch the EAP Duration Breakdown chart from a line chart to a stacked area chart, remove the extra p90 percentile, use high-fidelity time intervals, alias series names to match the regular chart format (e.g. `p50()` instead of `p50(span.duration)`), and add URL-based legend selection persistence via the `unselectedSeries` query parameter. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c761655 commit 58f0bbc

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

static/app/views/performance/transactionSummary/transactionOverview/useWidgetChartVisualization.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import {useTheme} from '@emotion/react';
22

3+
import {getInterval, getSeriesSelection} from 'sentry/components/charts/utils';
34
import usePageFilters from 'sentry/components/pageFilters/usePageFilters';
5+
import {parseFunction} from 'sentry/utils/discover/fields';
46
import {decodeScalar} from 'sentry/utils/queryString';
57
import {useFetchSpanTimeSeries} from 'sentry/utils/timeSeries/useFetchEventsTimeSeries';
68
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
79
import {useLocation} from 'sentry/utils/useLocation';
10+
import {useNavigate} from 'sentry/utils/useNavigate';
811
import {useReleaseStats} from 'sentry/utils/useReleaseStats';
9-
import {Line} from 'sentry/views/dashboards/widgets/timeSeriesWidget/plottables/line';
12+
import {Area} from 'sentry/views/dashboards/widgets/timeSeriesWidget/plottables/area';
1013
import {TimeSeriesWidgetVisualization} from 'sentry/views/dashboards/widgets/timeSeriesWidget/timeSeriesWidgetVisualization';
1114
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
1215
import {SpanFields} from 'sentry/views/insights/types';
@@ -73,8 +76,10 @@ function useDurationBreakdownVisualization({
7376
query,
7477
}: DurationBreakdownVisualizationOptions) {
7578
const location = useLocation();
79+
const navigate = useNavigate();
7680
const spanCategoryUrlParam = decodeScalar(location.query?.[SpanFields.SPAN_CATEGORY]);
7781
const {selection} = usePageFilters();
82+
const legendSelection = getSeriesSelection(location);
7883

7984
const {releases: releasesWithDate} = useReleaseStats(selection);
8085
const releases =
@@ -104,11 +109,11 @@ function useDurationBreakdownVisualization({
104109
'p100(span.duration)',
105110
'p99(span.duration)',
106111
'p95(span.duration)',
107-
'p90(span.duration)',
108112
'p75(span.duration)',
109113
'p50(span.duration)',
110114
],
111115
query: newQuery,
116+
interval: getInterval(selection.datetime, 'high'),
112117
enabled,
113118
},
114119
REFERRER
@@ -122,13 +127,27 @@ function useDurationBreakdownVisualization({
122127
return <TimeSeriesWidgetVisualization.LoadingPlaceholder />;
123128
}
124129

125-
const plottables = spanSeriesData?.timeSeries.map(series => new Line(series));
130+
const plottables = spanSeriesData?.timeSeries.map(series => {
131+
const name = `${parseFunction(series.yAxis)?.name}()`;
132+
return new Area(series, {name, alias: name});
133+
});
126134

127135
return (
128136
<TimeSeriesWidgetVisualization
129137
plottables={plottables}
130138
releases={releases}
131139
showReleaseAs="bubble"
140+
legendSelection={legendSelection}
141+
onLegendSelectionChange={selected => {
142+
const unselected = Object.keys(selected).filter(key => !selected[key]);
143+
navigate({
144+
...location,
145+
query: {
146+
...location.query,
147+
unselectedSeries: unselected,
148+
},
149+
});
150+
}}
132151
/>
133152
);
134153
}

0 commit comments

Comments
 (0)