From b9b797adf9e3ea8f3e6f9e9a71c5c73ca021aa55 Mon Sep 17 00:00:00 2001 From: Isabella Enriquez Date: Mon, 3 Mar 2025 11:08:15 -0800 Subject: [PATCH] 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) --- .../gsApp/views/subscriptionPage/usageAlert.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/static/gsApp/views/subscriptionPage/usageAlert.tsx b/static/gsApp/views/subscriptionPage/usageAlert.tsx index 0b3a949c8c531b..40202f059db3b6 100644 --- a/static/gsApp/views/subscriptionPage/usageAlert.tsx +++ b/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 (