Skip to content

Commit bc6fea6

Browse files
ryan953andrewshie-sentry
authored andcommitted
feat(insights): Invert the Error-Free Sessions chart to be Errored Sessions (#89315)
it's very similar to the Session Health chart, without the breakdowns. I think this is ok for now as users have a choice in their defaults, and can use the dropdowns to lay things out. Session data should exist for all web&mobile projects, whereas user data won't. Here's an image to show the two most similar charts side-by-side, this is not the default. The default is still for ErrorFreeSessionsChart & NewAndResolvedIssueChart to be on the first row. ![SCR-20250410-kdfp](https://github.com/user-attachments/assets/314952f7-bdc7-4746-99d2-4511016abf5b)
1 parent abfee93 commit bc6fea6

File tree

5 files changed

+27
-24
lines changed

5 files changed

+27
-24
lines changed

static/app/views/insights/sessions/charts/errorFreeSessionsChart.tsx renamed to static/app/views/insights/sessions/charts/erroredSessionsChart.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ import ExternalLink from 'sentry/components/links/externalLink';
22
import {t, tct} from 'sentry/locale';
33
import {InsightsLineChartWidget} from 'sentry/views/insights/common/components/insightsLineChartWidget';
44
import ChartSelectionTitle from 'sentry/views/insights/sessions/components/chartSelectionTitle';
5-
import useErrorFreeSessions from 'sentry/views/insights/sessions/queries/useErrorFreeSessions';
5+
import useErroredSessions from 'sentry/views/insights/sessions/queries/useErroredSessions';
66
import {CHART_TITLES} from 'sentry/views/insights/sessions/settings';
77
import {SESSION_HEALTH_CHART_HEIGHT} from 'sentry/views/insights/sessions/utils/sessions';
88

9-
export default function ErrorFreeSessionsChart() {
10-
const {series, isPending, error} = useErrorFreeSessions();
9+
export default function ErroredSessionsChart() {
10+
const {series, isPending, error} = useErroredSessions();
1111

1212
const aliases = {
13-
successful_session_rate: t('crash_free_rate(session)'),
13+
successful_session_rate: t('error_rate(sessions)'),
1414
};
1515

1616
return (
1717
<InsightsLineChartWidget
18-
title={CHART_TITLES.ErrorFreeSessionsChart}
18+
title={CHART_TITLES.ErroredSessionsChart}
1919
interactiveTitle={() => (
20-
<ChartSelectionTitle title={CHART_TITLES.ErrorFreeSessionsChart} />
20+
<ChartSelectionTitle title={CHART_TITLES.ErroredSessionsChart} />
2121
)}
2222
height={SESSION_HEALTH_CHART_HEIGHT}
2323
description={tct(

static/app/views/insights/sessions/components/chartMap.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {ReactElement} from 'react';
33
import type {Project} from 'sentry/types/project';
44
import type {DomainView} from 'sentry/views/insights/pages/useFilters';
55
import CrashFreeSessionsChart from 'sentry/views/insights/sessions/charts/crashFreeSessionsChart';
6-
import ErrorFreeSessionsChart from 'sentry/views/insights/sessions/charts/errorFreeSessionsChart';
6+
import ErroredSessionsChart from 'sentry/views/insights/sessions/charts/erroredSessionsChart';
77
import NewAndResolvedIssueChart from 'sentry/views/insights/sessions/charts/newAndResolvedIssueChart';
88
import ReleaseNewIssuesChart from 'sentry/views/insights/sessions/charts/releaseNewIssuesChart';
99
import ReleaseSessionCountChart from 'sentry/views/insights/sessions/charts/releaseSessionCountChart';
@@ -19,9 +19,9 @@ export const CHART_MAP: Record<
1919
(props: {project: Project}) => ReactElement
2020
> = {
2121
CrashFreeSessionsChart,
22-
ErrorFreeSessionsChart,
23-
NewAndResolvedIssueChart, //
24-
ReleaseNewIssuesChart, //
22+
ErroredSessionsChart,
23+
NewAndResolvedIssueChart,
24+
ReleaseNewIssuesChart,
2525
ReleaseSessionCountChart,
2626
ReleaseSessionPercentageChart,
2727
SessionHealthCountChart,
@@ -30,14 +30,19 @@ export const CHART_MAP: Record<
3030
UserHealthRateChart,
3131
};
3232

33+
export const CHART_RENAMES: Record<string, keyof typeof CHART_TITLES> = {
34+
// Map from the old name to the new
35+
ErrorFreeSessionsChart: 'ErroredSessionsChart',
36+
};
37+
3338
export const PAGE_CHART_OPTIONS: Record<
3439
DomainView,
3540
ReadonlyArray<keyof typeof CHART_MAP>
3641
> = {
3742
frontend: [
3843
// ORDER MATTERS HERE
3944
// The order things are listed is the order rendered
40-
'ErrorFreeSessionsChart',
45+
'ErroredSessionsChart',
4146
'NewAndResolvedIssueChart',
4247
'SessionHealthCountChart',
4348
'SessionHealthRateChart',
@@ -67,7 +72,7 @@ export const DEFAULT_LAYOUTS: Record<
6772
frontend: [
6873
// ORDER MATTERS HERE
6974
// The order represents the default chart layout for Frontend > Session Health
70-
'ErrorFreeSessionsChart',
75+
'ErroredSessionsChart',
7176
'UserHealthRateChart',
7277
'SessionHealthRateChart',
7378
'SessionHealthCountChart',

static/app/views/insights/sessions/components/chartPlacement.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {Widget} from 'sentry/views/dashboards/widgets/widget/widget';
88
import type {DomainView} from 'sentry/views/insights/pages/useFilters';
99
import {
1010
CHART_MAP,
11+
CHART_RENAMES,
1112
DEFAULT_LAYOUTS,
1213
PAGE_CHART_OPTIONS,
1314
} from 'sentry/views/insights/sessions/components/chartMap';
@@ -57,7 +58,7 @@ export function ChartPlacementSlot({view, index, chartProps}: Props) {
5758
[chartsByIndex, index, setChartsByIndex]
5859
);
5960

60-
const chartName = chartsByIndex[index];
61+
const chartName = CHART_RENAMES[chartsByIndex[index] as string] ?? chartsByIndex[index];
6162
const Chart = chartName && CHART_MAP[chartName];
6263
if (Chart) {
6364
return (

static/app/views/insights/sessions/queries/useErrorFreeSessions.tsx renamed to static/app/views/insights/sessions/queries/useErroredSessions.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,18 @@ import useOrganization from 'sentry/utils/useOrganization';
66
import usePageFilters from 'sentry/utils/usePageFilters';
77
import {getSessionStatusSeries} from 'sentry/views/insights/sessions/utils/sessions';
88

9-
export default function useErrorFreeSessions() {
9+
export default function useErroredSessions() {
1010
const location = useLocation();
1111
const organization = useOrganization();
1212
const {
1313
selection: {datetime},
1414
} = usePageFilters();
1515

1616
const locationQuery = {
17-
...location,
18-
query: {
19-
...location.query,
20-
query: undefined,
21-
width: undefined,
22-
cursor: undefined,
23-
},
17+
...location.query,
18+
query: undefined,
19+
width: undefined,
20+
cursor: undefined,
2421
};
2522

2623
const {
@@ -32,7 +29,7 @@ export default function useErrorFreeSessions() {
3229
`/organizations/${organization.slug}/sessions/`,
3330
{
3431
query: {
35-
...locationQuery.query,
32+
...locationQuery,
3633
interval: getSessionsInterval(datetime),
3734
field: ['sum(session)'],
3835
groupBy: ['session.status'],
@@ -60,7 +57,7 @@ export default function useErrorFreeSessions() {
6057

6158
return {
6259
name: sessionData.intervals[idx] ?? '',
63-
value: intervalTotal > 0 ? healthyCount / intervalTotal : 1,
60+
value: intervalTotal > 0 ? (intervalTotal - healthyCount) / intervalTotal : 0,
6461
};
6562
}
6663
);

static/app/views/insights/sessions/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const MODULE_VISIBLE_FEATURES = ['insights-session-health-tab-ui'];
1212

1313
export const CHART_TITLES = {
1414
CrashFreeSessionsChart: t('Crash Free Sessions'),
15-
ErrorFreeSessionsChart: t('Error Free Sessions'),
15+
ErroredSessionsChart: t('Errored Sessions'),
1616
NewAndResolvedIssueChart: t('Issues'),
1717
ReleaseNewIssuesChart: t('New Issues by Release'),
1818
ReleaseSessionCountChart: t('Total Sessions by Release'),

0 commit comments

Comments
 (0)