Browse Source

feat(releases): Remove session duration (#43107)

Matej Minar 2 years ago
parent
commit
495593be68

+ 1 - 1
static/app/components/assistant/getGuidesContent.tsx

@@ -566,7 +566,7 @@ function getDemoModeGuidesV2(): GuidesContent {
           title: t('Release-specfic trends'),
           target: 'release_version',
           description: t(
-            `Select the latest release to review new and regressed issues, and business critical metrics like crash rate, user adoption, and session duration.`
+            `Select the latest release to review new and regressed issues, and business critical metrics like crash rate, and user adoption.`
           ),
         },
       ],

+ 0 - 1
static/app/types/release.tsx

@@ -170,7 +170,6 @@ export enum ReleaseComparisonChartType {
   ERROR_COUNT = 'errorCount',
   TRANSACTION_COUNT = 'transactionCount',
   FAILURE_RATE = 'failureRate',
-  SESSION_DURATION = 'sessionDuration',
 }
 
 export enum HealthStatsPeriodOption {

+ 0 - 25
static/app/utils/sessions.tsx

@@ -157,31 +157,6 @@ export function getSessionStatusRateSeries(
   );
 }
 
-export function getSessionP50Series(
-  groups: SessionApiResponse['groups'] = [],
-  intervals: SessionApiResponse['intervals'] = [],
-  field: SessionFieldWithOperation,
-  valueFormatter?: (value: number) => number
-): SeriesDataUnit[] {
-  return compact(
-    intervals.map((interval, i) => {
-      const meanValue = mean(
-        groups.map(group => group.series[field][i]).filter(v => !!v)
-      );
-
-      if (!meanValue) {
-        return null;
-      }
-
-      return {
-        name: interval,
-        value:
-          typeof valueFormatter === 'function' ? valueFormatter(meanValue) : meanValue,
-      };
-    })
-  );
-}
-
 export function getAdoptionSeries(
   releaseGroups: SessionApiResponse['groups'] = [],
   allGroups: SessionApiResponse['groups'] = [],

+ 5 - 7
static/app/views/releases/detail/overview/releaseComparisonChart/index.spec.tsx

@@ -36,14 +36,13 @@ describe('Releases > Detail > Overview > ReleaseComparison', () => {
     );
     expect(screen.getByLabelText('Chart Value')).toHaveTextContent(/95\.006% 4\.51%/);
 
-    expect(screen.getAllByRole('radio').length).toBe(3);
+    expect(screen.getAllByRole('radio').length).toBe(2);
 
     // lazy way to make sure that all percentages are calculated correctly
     expect(
       screen.getByTestId('release-comparison-table').textContent
     ).toMatchInlineSnapshot(
-      // eslint-disable-next-line no-irregular-whitespace
-      `"DescriptionAll ReleasesThis ReleaseChangeCrash Free Session Rate 99.516%95.006%4.51% Crash Free User Rate 99.908%75%24.908% Session Duration p50 37s195ms—Show 2 Others"`
+      `"DescriptionAll ReleasesThis ReleaseChangeCrash Free Session Rate 99.516%95.006%4.51% Crash Free User Rate 99.908%75%24.908% Show 2 Others"` // eslint-disable-line no-irregular-whitespace
     );
   });
 
@@ -117,13 +116,12 @@ describe('Releases > Detail > Overview > ReleaseComparison', () => {
     });
     userEvent.click(screen.getByLabelText(/toggle additional/i));
 
-    expect(screen.getAllByRole('radio').length).toBe(13);
+    expect(screen.getAllByRole('radio').length).toBe(12);
     // lazy way to make sure that all percentages are calculated correctly
     expect(
       screen.getByTestId('release-comparison-table').textContent
     ).toMatchInlineSnapshot(
-      // eslint-disable-next-line no-irregular-whitespace
-      `"DescriptionAll ReleasesThis ReleaseChangeCrash Free Session Rate 99.516%95.006%4.51% Healthy 98.564%94.001%4.563% Abnormal 0%0%0% Errored 0.953%1.005%0.052% Crashed Session Rate 0.484%4.994%4.511% Crash Free User Rate 99.908%75%24.908% Healthy 98.994%72.022%26.972% Abnormal 0%0%0% Errored 0.914%2.493%1.579% Crashed User Rate 0.092%25.485%25.393% Session Duration p50 37s195ms—Session Count 205k9.8k—User Count 100k361—Hide 2 Others"`
+      `"DescriptionAll ReleasesThis ReleaseChangeCrash Free Session Rate 99.516%95.006%4.51% Healthy 98.564%94.001%4.563% Abnormal 0%0%0% Errored 0.953%1.005%0.052% Crashed Session Rate 0.484%4.994%4.511% Crash Free User Rate 99.908%75%24.908% Healthy 98.994%72.022%26.972% Abnormal 0%0%0% Errored 0.914%2.493%1.579% Crashed User Rate 0.092%25.485%25.393% Session Count 205k9.8k—User Count 100k361—Hide 2 Others"` // eslint-disable-line no-irregular-whitespace
     );
 
     // toggle back
@@ -132,7 +130,7 @@ describe('Releases > Detail > Overview > ReleaseComparison', () => {
     });
     userEvent.click(screen.getByLabelText(/toggle additional/i));
 
-    expect(screen.getAllByRole('radio').length).toBe(3);
+    expect(screen.getAllByRole('radio').length).toBe(2);
   });
 
   it('does not show expanders if there is no health data', async () => {

+ 1 - 31
static/app/views/releases/detail/overview/releaseComparisonChart/index.tsx

@@ -9,7 +9,6 @@ import Button from 'sentry/components/button';
 import ErrorPanel from 'sentry/components/charts/errorPanel';
 import {ChartContainer} from 'sentry/components/charts/styles';
 import Count from 'sentry/components/count';
-import Duration from 'sentry/components/duration';
 import ErrorBoundary from 'sentry/components/errorBoundary';
 import GlobalSelectionLink from 'sentry/components/globalSelectionLink';
 import NotAvailable from 'sentry/components/notAvailable';
@@ -33,12 +32,7 @@ import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAna
 import {formatPercentage} from 'sentry/utils/formatters';
 import getDynamicText from 'sentry/utils/getDynamicText';
 import {decodeList, decodeScalar} from 'sentry/utils/queryString';
-import {
-  getCount,
-  getCrashFreeRate,
-  getSeriesAverage,
-  getSessionStatusRate,
-} from 'sentry/utils/sessions';
+import {getCount, getCrashFreeRate, getSessionStatusRate} from 'sentry/utils/sessions';
 import {Color} from 'sentry/utils/theme';
 import {MutableSearch} from 'sentry/utils/tokenizeSearch';
 import {
@@ -47,7 +41,6 @@ import {
   getReleaseHandledIssuesUrl,
   getReleaseParams,
   getReleaseUnhandledIssuesUrl,
-  roundDuration,
 } from 'sentry/views/releases/utils';
 
 import ReleaseComparisonChartRow from './releaseComparisonChartRow';
@@ -456,15 +449,6 @@ function ReleaseComparisonChart({
   );
   const allUsersCount = getCount(allSessions?.groups, SessionFieldWithOperation.USERS);
 
-  const sessionDurationTotal = roundDuration(
-    (getSeriesAverage(releaseSessions?.groups, SessionFieldWithOperation.DURATION) ?? 0) /
-      1000
-  );
-  const allSessionDurationTotal = roundDuration(
-    (getSeriesAverage(allSessions?.groups, SessionFieldWithOperation.DURATION) ?? 0) /
-      1000
-  );
-
   const diffFailure =
     eventsTotals?.releaseFailureRate && eventsTotals?.allFailureRate
       ? eventsTotals.releaseFailureRate - eventsTotals.allFailureRate
@@ -767,20 +751,6 @@ function ReleaseComparisonChart({
   }
 
   if (hasHealthData) {
-    charts.push({
-      type: ReleaseComparisonChartType.SESSION_DURATION,
-      role: 'default',
-      drilldown: null,
-      thisRelease: defined(sessionDurationTotal) ? (
-        <Duration seconds={sessionDurationTotal} abbreviation />
-      ) : null,
-      allReleases: defined(allSessionDurationTotal) ? (
-        <Duration seconds={allSessionDurationTotal} abbreviation />
-      ) : null,
-      diff: null,
-      diffDirection: null,
-      diffColor: null,
-    });
     additionalCharts.push({
       type: ReleaseComparisonChartType.SESSION_COUNT,
       role: 'default',

+ 1 - 44
static/app/views/releases/detail/overview/releaseComparisonChart/releaseSessionsChart.tsx

@@ -21,18 +21,16 @@ import {
   SessionStatus,
 } from 'sentry/types';
 import {defined} from 'sentry/utils';
-import {getDuration, getExactDuration} from 'sentry/utils/formatters';
 import {
   getCountSeries,
   getCrashFreeRateSeries,
-  getSessionP50Series,
   getSessionStatusRateSeries,
   initSessionsChart,
   MINUTES_THRESHOLD_TO_DISPLAY_SECONDS,
 } from 'sentry/utils/sessions';
 // eslint-disable-next-line no-restricted-imports
 import withSentryRouter from 'sentry/utils/withSentryRouter';
-import {displayCrashFreePercent, roundDuration} from 'sentry/views/releases/utils';
+import {displayCrashFreePercent} from 'sentry/views/releases/utils';
 
 import {
   generateReleaseMarkLines,
@@ -82,10 +80,6 @@ class ReleaseSessionsChart extends Component<Props> {
       case ReleaseComparisonChartType.ERRORED_USERS:
       case ReleaseComparisonChartType.CRASHED_USERS:
         return defined(value) ? `${value}%` : '\u2015';
-      case ReleaseComparisonChartType.SESSION_DURATION:
-        return defined(value) && typeof value === 'number'
-          ? getExactDuration(value, true)
-          : '\u2015';
       case ReleaseComparisonChartType.SESSION_COUNT:
       case ReleaseComparisonChartType.USER_COUNT:
       default:
@@ -121,14 +115,6 @@ class ReleaseSessionsChart extends Component<Props> {
             color: theme.chartLabel,
           },
         };
-      case ReleaseComparisonChartType.SESSION_DURATION:
-        return {
-          scale: true,
-          axisLabel: {
-            formatter: (value: number) => getDuration(value, undefined, true),
-            color: theme.chartLabel,
-          },
-        };
       case ReleaseComparisonChartType.SESSION_COUNT:
       case ReleaseComparisonChartType.USER_COUNT:
       default:
@@ -154,7 +140,6 @@ class ReleaseSessionsChart extends Component<Props> {
       default:
         return AreaChart;
       case ReleaseComparisonChartType.SESSION_COUNT:
-      case ReleaseComparisonChartType.SESSION_DURATION:
       case ReleaseComparisonChartType.USER_COUNT:
         return StackedAreaChart;
     }
@@ -185,7 +170,6 @@ class ReleaseSessionsChart extends Component<Props> {
       case ReleaseComparisonChartType.CRASHED_USERS:
         return [theme.red300];
       case ReleaseComparisonChartType.SESSION_COUNT:
-      case ReleaseComparisonChartType.SESSION_DURATION:
       case ReleaseComparisonChartType.USER_COUNT:
       default:
         return undefined;
@@ -515,33 +499,6 @@ class ReleaseSessionsChart extends Component<Props> {
           ],
           markLines,
         };
-      case ReleaseComparisonChartType.SESSION_DURATION:
-        return {
-          series: [
-            {
-              seriesName: t('This Release'),
-              connectNulls: true,
-              data: getSessionP50Series(
-                releaseSessions?.groups,
-                releaseSessions?.intervals,
-                SessionFieldWithOperation.DURATION,
-                duration => roundDuration(duration / 1000)
-              ),
-            },
-          ],
-          previousSeries: [
-            {
-              seriesName: t('All Releases'),
-              data: getSessionP50Series(
-                allSessions?.groups,
-                allSessions?.intervals,
-                SessionFieldWithOperation.DURATION,
-                duration => roundDuration(duration / 1000)
-              ),
-            },
-          ],
-          markLines,
-        };
       case ReleaseComparisonChartType.USER_COUNT:
         return {
           series: [

+ 0 - 2
static/app/views/releases/detail/utils.tsx

@@ -116,7 +116,6 @@ export const releaseComparisonChartLabels = {
   [ReleaseComparisonChartType.ERRORED_USERS]: t('Errored'),
   [ReleaseComparisonChartType.CRASHED_USERS]: t('Crashed User Rate'),
   [ReleaseComparisonChartType.SESSION_COUNT]: t('Session Count'),
-  [ReleaseComparisonChartType.SESSION_DURATION]: t('Session Duration p50'),
   [ReleaseComparisonChartType.USER_COUNT]: t('User Count'),
   [ReleaseComparisonChartType.ERROR_COUNT]: t('Error Count'),
   [ReleaseComparisonChartType.TRANSACTION_COUNT]: t('Transaction Count'),
@@ -135,7 +134,6 @@ export const releaseComparisonChartTitles = {
   [ReleaseComparisonChartType.ERRORED_USERS]: t('Errored User Rate'),
   [ReleaseComparisonChartType.CRASHED_USERS]: t('Crashed User Rate'),
   [ReleaseComparisonChartType.SESSION_COUNT]: t('Session Count'),
-  [ReleaseComparisonChartType.SESSION_DURATION]: t('Session Duration'),
   [ReleaseComparisonChartType.USER_COUNT]: t('User Count'),
   [ReleaseComparisonChartType.ERROR_COUNT]: t('Error Count'),
   [ReleaseComparisonChartType.TRANSACTION_COUNT]: t('Transaction Count'),

+ 0 - 1
static/app/views/releases/utils/sessionTerm.tsx

@@ -29,7 +29,6 @@ export const sessionTerm = {
   [SessionTerm.ADOPTION]: t('Adoption'),
   [SessionTerm.ANR_RATE]: t('ANR Rate'),
   [SessionTerm.FOREGROUND_ANR_RATE]: t('Foreground ANR Rate'),
-  duration: t('Session Duration'),
   otherCrashed: t('Other Crashed'),
   otherAbnormal: t('Other Abnormal'),
   otherErrored: t('Other Errored'),