Skip to content

chore(billing): Added data category constant for trace metric byte(BIL-2213)#112286

Merged
krithikravi merged 4 commits intomasterfrom
billed-category-tracemetrics
Apr 6, 2026
Merged

chore(billing): Added data category constant for trace metric byte(BIL-2213)#112286
krithikravi merged 4 commits intomasterfrom
billed-category-tracemetrics

Conversation

@krithikravi
Copy link
Copy Markdown
Member

@krithikravi krithikravi commented Apr 6, 2026

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.

@krithikravi krithikravi requested a review from a team as a code owner April 6, 2026 20:30
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 6, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 6, 2026
Comment on lines +199 to +205
[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',
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Missing test update causes toStrictEqual failure
    • Updated useUpgradeNowParams.spec.tsx to include reservedInstallableBuilds and reservedTraceMetricBytes in the strict expected reservations object.

Create PR

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.

Comment on lines +199 to +205
[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',
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in master

@krithikravi krithikravi merged commit 4fd1d10 into master Apr 6, 2026
68 checks passed
@krithikravi krithikravi deleted the billed-category-tracemetrics branch April 6, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants