Browse Source

fix(stat-detectors): Use absolute change in regression message (#58954)

Makes the change clearer for the user, in addition to providing the
percentage change.
Nar Saynorath 1 year ago
parent
commit
69bfd026a1

+ 18 - 8
static/app/components/events/eventStatisticalDetector/regressionMessage.tsx

@@ -47,29 +47,39 @@ function EventStatisticalDetectorRegressedPerformanceMessage({
 }: EventStatisticalDetectorMessageProps) {
   const organization = useOrganization();
 
-  const transactionName = event?.occurrence?.evidenceData?.transaction;
+  const {transaction, breakpoint, aggregateRange1, aggregateRange2, trendPercentage} =
+    event?.occurrence?.evidenceData ?? {};
   const transactionSummaryLink = transactionSummaryRouteWithQuery({
     orgSlug: organization.slug,
-    transaction: transactionName,
+    transaction,
     query: {},
     trendFunction: 'p95',
     projectID: event.projectID,
     display: DisplayModes.TREND,
   });
-  const detectionTime = new Date(event?.occurrence?.evidenceData?.breakpoint * 1000);
+  const detectionTime = new Date(breakpoint * 1000);
 
   return (
     <DataSection>
       <div style={{display: 'inline'}}>
         {tct(
-          '[detected] Based on the transaction [transactionName], there was a [amount] increase in duration (P95) around [date] at [time]. Overall operation percentage changes indicate what may have changed in the regression.',
+          'Based on the transaction [transactionName], there was a [absoluteChange] ([percentageAmount]) increase in duration (P95) from [previousDuration] to [regressionDuration] around [date] at [time]. Overall operation percentage changes indicate what may have changed in the regression.',
           {
-            detected: <strong>{t('Detected:')}</strong>,
             transactionName: (
-              <Link to={normalizeUrl(transactionSummaryLink)}>{transactionName}</Link>
+              <Link to={normalizeUrl(transactionSummaryLink)}>{transaction}</Link>
             ),
-            amount: formatPercentage(
-              event?.occurrence?.evidenceData?.trendPercentage - 1
+            absoluteChange: (
+              <PerformanceDuration
+                abbreviation
+                milliseconds={aggregateRange2 - aggregateRange1}
+              />
+            ),
+            percentageAmount: formatPercentage(trendPercentage - 1),
+            previousDuration: (
+              <PerformanceDuration abbreviation milliseconds={aggregateRange1} />
+            ),
+            regressionDuration: (
+              <PerformanceDuration abbreviation milliseconds={aggregateRange2} />
             ),
             date: <DateTime date={detectionTime} dateOnly />,
             time: <DateTime date={detectionTime} timeOnly />,