Skip to content

Commit f730536

Browse files
authored
feat(insights): Hide healthy Session Health counts & rates by default (#87252)
This PR re-labels the charts and series so that the series names are shorter, less redundant. As a consequence the chart titles are longer again. The charts also hide the "healthy" series of data by default, users can click the legend to toggle that series though. Toggling a series in one chart will affect all charts when the series name is the same. All the names are consistent now between all the charts. ![SCR-20250318-lzex](https://github.com/user-attachments/assets/adf6a0b6-5da0-41d0-8b3b-e2109fe8e664)
1 parent 7c4818a commit f730536

File tree

9 files changed

+52
-59
lines changed

9 files changed

+52
-59
lines changed

static/app/views/dashboards/widgets/timeSeriesWidget/plottables/line.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class Line extends ContinuousTimeSeries implements Plottable {
2525

2626
const plottableSeries: LineSeriesOption[] = [];
2727

28-
const commonOptions = {
28+
const commonOptions: LineSeriesOption = {
2929
name: this.label,
3030
color,
3131
animation: false,

static/app/views/dashboards/widgets/timeSeriesWidget/timeSeriesWidgetVisualization.stories.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ export default storyBook('TimeSeriesWidgetVisualization', (story, APIReference)
471471

472472
story('Legends', () => {
473473
const [legendSelection, setLegendSelection] = useState<LegendSelection>({
474-
'p99(span.duration)': false,
474+
p99: false,
475475
});
476476

477477
return (
@@ -496,6 +496,8 @@ export default storyBook('TimeSeriesWidgetVisualization', (story, APIReference)
496496
default.
497497
</p>
498498

499+
<code>{JSON.stringify(legendSelection)}</code>
500+
499501
<MediumWidget>
500502
<TimeSeriesWidgetVisualization
501503
plottables={[

static/app/views/insights/common/components/insightsTimeSeriesWidget.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import useOrganization from 'sentry/utils/useOrganization';
99
import usePageFilters from 'sentry/utils/usePageFilters';
1010
import {useReleaseStats} from 'sentry/utils/useReleaseStats';
1111
import {MISSING_DATA_MESSAGE} from 'sentry/views/dashboards/widgets/common/settings';
12+
import type {LegendSelection} from 'sentry/views/dashboards/widgets/common/types';
1213
import {Area} from 'sentry/views/dashboards/widgets/timeSeriesWidget/plottables/area';
1314
import {Bars} from 'sentry/views/dashboards/widgets/timeSeriesWidget/plottables/bars';
1415
import {Line} from 'sentry/views/dashboards/widgets/timeSeriesWidget/plottables/line';
@@ -38,6 +39,8 @@ export interface InsightsTimeSeriesWidgetProps {
3839
visualizationType: 'line' | 'area' | 'bar';
3940
aliases?: Record<string, string>;
4041
description?: React.ReactNode;
42+
legendSelection?: LegendSelection | undefined;
43+
onLegendSelectionChange?: ((selection: LegendSelection) => void) | undefined;
4144
stacked?: boolean;
4245
}
4346

@@ -115,6 +118,8 @@ export function InsightsTimeSeriesWidget(props: InsightsTimeSeriesWidgetProps) {
115118
{...(organization.features.includes('release-bubbles-ui')
116119
? {releases, showReleaseAs: 'bubble'}
117120
: {})}
121+
legendSelection={props.legendSelection}
122+
onLegendSelectionChange={props.onLegendSelectionChange}
118123
{...visualizationProps}
119124
/>
120125
}
@@ -135,6 +140,8 @@ export function InsightsTimeSeriesWidget(props: InsightsTimeSeriesWidgetProps) {
135140
<ModalChartContainer>
136141
<TimeSeriesWidgetVisualization
137142
{...visualizationProps}
143+
legendSelection={props.legendSelection}
144+
onLegendSelectionChange={props.onLegendSelectionChange}
138145
releases={releases ?? []}
139146
/>
140147
</ModalChartContainer>

static/app/views/insights/sessions/charts/errorFreeSessionsChart.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function ErrorFreeSessionsChart() {
77
const {series, isPending, error} = useErrorFreeSessions();
88

99
const aliases = {
10-
successful_session_rate: t('Error free session rate'),
10+
successful_session_rate: t('crash_free_rate(session)'),
1111
};
1212

1313
return (
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
import ExternalLink from 'sentry/components/links/externalLink';
22
import {t, tct} from 'sentry/locale';
33
import {InsightsLineChartWidget} from 'sentry/views/insights/common/components/insightsLineChartWidget';
4-
import {FRONTEND_LANDING_SUB_PATH} from 'sentry/views/insights/pages/frontend/settings';
54
import useSessionHealthBreakdown from 'sentry/views/insights/sessions/queries/useSessionHealthBreakdown';
65

7-
export default function SessionHealthCountChart({view}: {view: string}) {
6+
export default function SessionHealthCountChart() {
87
const {series, isPending, error} = useSessionHealthBreakdown({type: 'count'});
9-
const frontendPath = view === FRONTEND_LANDING_SUB_PATH;
108

119
const aliases = {
12-
healthy_session_count: t('Healthy session count'),
13-
crashed_session_count: frontendPath
14-
? t('Unhandled error session count')
15-
: t('Crashed session count'),
16-
errored_session_count: frontendPath
17-
? t('Handled error session count')
18-
: t('Errored session count'),
19-
abnormal_session_count: t('Abnormal session count'),
10+
healthy_session_count: 'count_healthy(session)',
11+
crashed_session_count: 'count_crashed(session)',
12+
errored_session_count: 'count_errored(session)',
13+
abnormal_session_count: 'count_abnormal(session)',
2014
};
2115

2216
return (
2317
<InsightsLineChartWidget
24-
title={t('Sessions')}
18+
title={t('Session Counts')}
2519
description={tct(
2620
'The count of sessions with each health status. See [link:session status].',
2721
{
@@ -34,6 +28,9 @@ export default function SessionHealthCountChart({view}: {view: string}) {
3428
series={series}
3529
isLoading={isPending}
3630
error={error}
31+
legendSelection={{
32+
[aliases.healthy_session_count]: false,
33+
}}
3734
/>
3835
);
3936
}
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
import ExternalLink from 'sentry/components/links/externalLink';
22
import {t, tct} from 'sentry/locale';
33
import {InsightsAreaChartWidget} from 'sentry/views/insights/common/components/insightsAreaChartWidget';
4-
import {FRONTEND_LANDING_SUB_PATH} from 'sentry/views/insights/pages/frontend/settings';
54
import useSessionHealthBreakdown from 'sentry/views/insights/sessions/queries/useSessionHealthBreakdown';
65

7-
export default function SessionHealthRateChart({view}: {view: string}) {
6+
export default function SessionHealthRateChart() {
87
const {series, isPending, error} = useSessionHealthBreakdown({type: 'rate'});
9-
const frontendPath = view === FRONTEND_LANDING_SUB_PATH;
108

119
const aliases = {
12-
healthy_session_rate: t('Healthy session rate'),
13-
crashed_session_rate: frontendPath
14-
? t('Unhandled error session rate')
15-
: t('Crashed session rate'),
16-
errored_session_rate: frontendPath
17-
? t('Handled error session rate')
18-
: t('Errored session rate'),
19-
abnormal_session_rate: t('Abnormal session rate'),
10+
healthy_session_rate: 'rate_healthy(session)',
11+
crashed_session_rate: 'rate_crashed(session)',
12+
errored_session_rate: 'rate_errored(session)',
13+
abnormal_session_rate: 'rate_abnormal(session)',
2014
};
2115

2216
return (
@@ -34,6 +28,9 @@ export default function SessionHealthRateChart({view}: {view: string}) {
3428
series={series}
3529
isLoading={isPending}
3630
error={error}
31+
legendSelection={{
32+
[aliases.healthy_session_rate]: false,
33+
}}
3734
/>
3835
);
3936
}
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
import ExternalLink from 'sentry/components/links/externalLink';
22
import {t, tct} from 'sentry/locale';
33
import {InsightsLineChartWidget} from 'sentry/views/insights/common/components/insightsLineChartWidget';
4-
import {FRONTEND_LANDING_SUB_PATH} from 'sentry/views/insights/pages/frontend/settings';
54
import useUserHealthBreakdown from 'sentry/views/insights/sessions/queries/useUserHealthBreakdown';
65

7-
export default function UserHealthCountChart({view}: {view: string}) {
8-
const {series, isPending, error} = useUserHealthBreakdown({
9-
type: 'count',
10-
});
11-
const frontendPath = view === FRONTEND_LANDING_SUB_PATH;
6+
export default function UserHealthCountChart() {
7+
const {series, isPending, error} = useUserHealthBreakdown({type: 'count'});
128

139
const aliases = {
14-
healthy_user_count: t('Healthy user count'),
15-
crashed_user_count: frontendPath
16-
? t('Unhandled error user count')
17-
: t('Crashed user count'),
18-
errored_user_count: frontendPath
19-
? t('Handled error user count')
20-
: t('Errored user count'),
21-
abnormal_user_count: t('Abnormal user count'),
10+
healthy_user_count: 'count_healthy(user)',
11+
crashed_user_count: 'count_crashed(user)',
12+
errored_user_count: 'count_errored(user)',
13+
abnormal_user_count: 'count_abnormal(user)',
2214
};
2315

2416
return (
2517
<InsightsLineChartWidget
26-
title={t('Users')}
18+
title={t('User Counts')}
2719
description={tct(
2820
'Breakdown of total [linkUsers:users], grouped by [linkStatus:health status].',
2921
{
@@ -39,6 +31,9 @@ export default function UserHealthCountChart({view}: {view: string}) {
3931
series={series}
4032
isLoading={isPending}
4133
error={error}
34+
legendSelection={{
35+
[aliases.healthy_user_count]: false,
36+
}}
4237
/>
4338
);
4439
}
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
import ExternalLink from 'sentry/components/links/externalLink';
22
import {t, tct} from 'sentry/locale';
33
import {InsightsAreaChartWidget} from 'sentry/views/insights/common/components/insightsAreaChartWidget';
4-
import {FRONTEND_LANDING_SUB_PATH} from 'sentry/views/insights/pages/frontend/settings';
54
import useUserHealthBreakdown from 'sentry/views/insights/sessions/queries/useUserHealthBreakdown';
65

7-
export default function UserHealthRateChart({view}: {view: string}) {
8-
const {series, isPending, error} = useUserHealthBreakdown({
9-
type: 'rate',
10-
});
11-
const frontendPath = view === FRONTEND_LANDING_SUB_PATH;
6+
export default function UserHealthRateChart() {
7+
const {series, isPending, error} = useUserHealthBreakdown({type: 'rate'});
128

139
const aliases = {
14-
healthy_user_rate: t('Healthy user rate'),
15-
crashed_user_rate: frontendPath
16-
? t('Unhandled error user rate')
17-
: t('Crashed user rate'),
18-
errored_user_rate: frontendPath
19-
? t('Handled error user rate')
20-
: t('Errored user rate'),
21-
abnormal_user_rate: t('Abnormal user rate'),
10+
healthy_user_rate: 'rate_healthy(user)',
11+
crashed_user_rate: 'rate_crashed(user)',
12+
errored_user_rate: 'rate_errored(user)',
13+
abnormal_user_rate: 'rate_abnormal(user)',
2214
};
2315

2416
return (
@@ -39,6 +31,9 @@ export default function UserHealthRateChart({view}: {view: string}) {
3931
series={series}
4032
isLoading={isPending}
4133
error={error}
34+
legendSelection={{
35+
[aliases.healthy_user_rate]: false,
36+
}}
4237
/>
4338
);
4439
}

static/app/views/insights/sessions/views/overview.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ export function SessionsOverview() {
5454
</ModuleLayout.Third>
5555
) : undefined}
5656
<ModuleLayout.Third>
57-
<SessionHealthCountChart view={view} />
57+
<SessionHealthCountChart />
5858
</ModuleLayout.Third>
5959
<ModuleLayout.Third>
60-
<UserHealthCountChart view={view} />
60+
<UserHealthCountChart />
6161
</ModuleLayout.Third>
6262
<ModuleLayout.Third />
6363
<ModuleLayout.Third>
64-
<SessionHealthRateChart view={view} />
64+
<SessionHealthRateChart />
6565
</ModuleLayout.Third>
6666
<ModuleLayout.Third>
67-
<UserHealthRateChart view={view} />
67+
<UserHealthRateChart />
6868
</ModuleLayout.Third>
6969
</Fragment>
7070
);

0 commit comments

Comments
 (0)