Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion static/app/constants/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ export const DATA_CATEGORY_INFO = {
titleName: t('Metrics (Bytes)'),
productName: t('Metrics'),
uid: 37,
isBilledCategory: false,
isBilledCategory: true,
statsInfo: {
...DEFAULT_STATS_INFO,
showExternalStats: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ describe('ProductSelectionAvailability', () => {
reservedSeerScanner: undefined,
reservedSeerUsers: undefined,
reservedSizeAnalyses: 0,
reservedTraceMetricBytes: 0,
};
const mockPlan = PlanFixture({});
const mockPreview = PreviewDataFixture({});
Expand Down
1 change: 1 addition & 0 deletions static/gsApp/components/productUnavailableCTA.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ describe('ProductUnavailableCTA', () => {
reservedSeerScanner: undefined,
reservedSeerUsers: undefined,
reservedSizeAnalyses: undefined,
reservedTraceMetricBytes: undefined,
};
const mockPlan = PlanFixture({});
const mockPreview = PreviewDataFixture({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const mockReservations: Reservations = {
reservedSeerScanner: 0,
reservedSeerUsers: 0,
reservedSizeAnalyses: 100,
reservedTraceMetricBytes: undefined,
};

const mockPreview = PreviewDataFixture({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe('useUpgradeNowParams', () => {
reservedSeerScanner: 0,
reservedSeerUsers: 0,
reservedSizeAnalyses: 100,
reservedTraceMetricBytes: undefined,
},
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export function useUpgradeNowParams({organization, subscription, enabled = true}
reservedSeerScanner: reserved.seerScanner,
reservedSeerUsers: reserved.seerUsers,
reservedSizeAnalyses: reserved.sizeAnalyses,
reservedTraceMetricBytes: reserved.traceMetricBytes,
},
};
}, [billingConfig, isPending, subscription, enabled]);
Expand Down
7 changes: 7 additions & 0 deletions static/gsApp/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ export const BILLED_DATA_CATEGORY_INFO = {
),
shortenedUnitName: 'GB',
},
[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',
},
Comment on lines +199 to +205
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.

Comment on lines +199 to +205
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

[DataCategoryExact.SEER_USER]: {
...DEFAULT_BILLED_DATA_CATEGORY_INFO[DataCategoryExact.SEER_USER],
feature: 'seer-user-billing-launch',
Expand Down
Loading