chore(billing): Added data category constant for trace metric byte(BIL-2213)#112286
chore(billing): Added data category constant for trace metric byte(BIL-2213)#112286krithikravi merged 4 commits intomasterfrom
Conversation
| [DataCategoryExact.TRACE_METRIC_BYTE]: { | ||
| ...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.TRACE_METRIC_BYTE], | ||
| canProductTrial: true, | ||
| freeEventsMultiple: 1, | ||
| feature: 'expose-category-trace-metric-byte', | ||
| shortenedUnitName: 'GB', | ||
| }, |
There was a problem hiding this comment.
Bug: The new TRACE_METRIC_BYTE category is byte-based, but the isByteCategory() helper function was not updated to include it, which will cause incorrect billing and usage display calculations.
Severity: HIGH
Suggested Fix
Update the isByteCategory() function in static/gsApp/utils/dataCategory.tsx to include DataCategory.TRACE_METRIC_BYTE in its conditional check. This will ensure that byte-specific formatting and calculation logic is correctly applied to the new category.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: static/gsApp/constants.tsx#L199-L205
Potential issue: The pull request introduces a new billing category,
`TRACE_METRIC_BYTE`, which is configured for byte-based formatting. However, the helper
function `isByteCategory()` was not updated to include this new category. This function
is critical for various UI components and billing logic paths that handle
byte-to-gigabyte conversions and formatting. When the `TRACE_METRIC_BYTE` category is
activated in billing plans, its usage data will be calculated and displayed incorrectly
across multiple features like checkout pages, volume sliders, and usage charts because
the necessary byte-based logic will not be applied.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Missing test update causes
toStrictEqualfailure- Updated
useUpgradeNowParams.spec.tsxto includereservedInstallableBuildsandreservedTraceMetricBytesin the strict expected reservations object.
- Updated
Or push these changes by commenting:
@cursor push 8a880afe8c
Preview (8a880afe8c)
diff --git a/static/gsApp/components/upgradeNowModal/useUpgradeNowParams.spec.tsx b/static/gsApp/components/upgradeNowModal/useUpgradeNowParams.spec.tsx
--- a/static/gsApp/components/upgradeNowModal/useUpgradeNowParams.spec.tsx
+++ b/static/gsApp/components/upgradeNowModal/useUpgradeNowParams.spec.tsx
@@ -59,6 +59,8 @@
reservedSeerScanner: 0,
reservedSeerUsers: 0,
reservedSizeAnalyses: 100,
+ reservedInstallableBuilds: 25000,
+ reservedTraceMetricBytes: undefined,
},
})
);This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 643b475. Configure here.
| [DataCategoryExact.TRACE_METRIC_BYTE]: { | ||
| ...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.TRACE_METRIC_BYTE], | ||
| canProductTrial: true, | ||
| freeEventsMultiple: 1, | ||
| feature: 'expose-category-trace-metric-byte', | ||
| shortenedUnitName: 'GB', | ||
| }, |
There was a problem hiding this comment.
Bug: The isByteCategory utility function is missing the new TRACE_METRIC_BYTE category, causing incorrect calculations and display values in the billing UI.
Severity: HIGH
Suggested Fix
Update the isByteCategory function in static/gsApp/utils/dataCategory.tsx to include DataCategory.TRACE_METRIC_BYTE in its conditional check, alongside DataCategory.ATTACHMENTS and DataCategory.LOG_BYTE.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: static/gsApp/constants.tsx#L199-L205
Potential issue: The new data category `TRACE_METRIC_BYTE` was not added to the
`isByteCategory` utility function. This function is used in the billing UI to determine
if a value needs conversion between bytes and gigabytes. Consequently, in
`tableRow.tsx`, usage percentage calculations will be incorrect because the prepaid
amount (in GB) is not converted to bytes. In `checkoutSuccess.tsx`, the reserved volume
display will show a raw byte value instead of the correct value in GB. This will lead to
a broken billing UI for any organization using trace metric bytes.


https://linear.app/getsentry/issue/BIL-2213/set-billed-data-category-canproduct-for-trace-metrics
https://linear.app/getsentry/issue/BIL-2226/set-isbilledcategory-to-true-for-installable-builds
This PR adds a billed category entry for trace metric bytes. It also sets the isBilledCategory value to true for trace metric bytes.