Browse Source

fix(dynamic sampling): Correct spans nomenclature based on DS (#86213)

Updates the usage alert to use the right term when one of the included
categories is spans ("accepted span" when DS has been used during the
monthly usage cycle, "span" otherwise).

Closes
https://www.notion.so/sentry/Usage-exceeded-banner-should-not-include-stored-spans-when-no-DS-has-been-used-1a58b10e4b5d80bd945bde6ec7f4854b?pvs=4

# before 

![image](https://github.com/user-attachments/assets/d5c3f378-c75b-4f5d-8580-1569305db9a7)


# after

![image](https://github.com/user-attachments/assets/659fb96e-3ca1-49a9-bcad-62fdce8724a9)


If DS hasn't been used, the alert remains unchanged:

![image](https://github.com/user-attachments/assets/ab4d9b28-c75d-42fd-a6df-efa4a6a23687)
Isabella Enriquez 1 week ago
parent
commit
b9b797adf9
1 changed files with 10 additions and 5 deletions
  1. 10 5
      static/gsApp/views/subscriptionPage/usageAlert.tsx

+ 10 - 5
static/gsApp/views/subscriptionPage/usageAlert.tsx

@@ -60,6 +60,7 @@ function UsageAlert({organization, subscription, usage}: Props) {
       plan: subscription.planDetails,
       category,
       capitalize: false,
+      hadCustomDynamicSampling: subscription.hadCustomDynamicSampling,
     });
 
     return category === DataCategory.ATTACHMENTS
@@ -161,21 +162,24 @@ function UsageAlert({organization, subscription, usage}: Props) {
   }
 
   function renderExceededInfo() {
-    const exceededList = sortCategoriesWithKeys(subscription.categories).reduce(
-      (acc, [category, currentHistory]) => {
+    const exceededList = sortCategoriesWithKeys(subscription.categories)
+      .filter(
+        ([category]) =>
+          category !== DataCategory.SPANS_INDEXED || subscription.hadCustomDynamicSampling
+      )
+      .reduce((acc, [category, currentHistory]) => {
         if (currentHistory.usageExceeded) {
           acc.push(
             getPlanCategoryName({
               plan: subscription.planDetails,
               category,
               capitalize: false,
+              hadCustomDynamicSampling: subscription.hadCustomDynamicSampling,
             })
           );
         }
         return acc;
-      },
-      [] as string[]
-    );
+      }, [] as string[]);
 
     const quotasExceeded =
       exceededList.length > 0
@@ -184,6 +188,7 @@ function UsageAlert({organization, subscription, usage}: Props) {
             plan: subscription.planDetails,
             category: DataCategory.ERRORS,
             capitalize: false,
+            hadCustomDynamicSampling: subscription.hadCustomDynamicSampling,
           });
 
     return (