Skip to content

feat(billing): Gate trace metric bytes notification behind feature flag#112285

Merged
brendanhsentry merged 1 commit intomasterfrom
brendanhsentry/feat/notifications-trace-metric-bytes-fe
Apr 6, 2026
Merged

feat(billing): Gate trace metric bytes notification behind feature flag#112285
brendanhsentry merged 1 commit intomasterfrom
brendanhsentry/feat/notifications-trace-metric-bytes-fe

Conversation

@brendanhsentry
Copy link
Copy Markdown
Member

@brendanhsentry brendanhsentry commented Apr 6, 2026

The backend notification setting is added in #112282 — this PR handles the frontend ff gating.

closes https://linear.app/getsentry/issue/BIL-2216/update-notifications-backend-for-trace-metrics-settings

@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
@brendanhsentry brendanhsentry requested a review from a team April 6, 2026 20:38
@brendanhsentry brendanhsentry marked this pull request as ready for review April 6, 2026 20:38
@brendanhsentry brendanhsentry requested a review from a team as a code owner April 6, 2026 20:38
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 is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c3f80d6. Configure here.

'continuous-profiling-billing',
'seer-billing',
'logs-billing',
'expose-category-trace-metric-byte',
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.

Positive test missing assertion for Metrics (Bytes) visibility

Low Severity

The positive test case adds expose-category-trace-metric-byte to the features list but never asserts that Metrics (Bytes) is visible. Every other feature-gated category (profile hours, seer budget, logs, active contributors) has a corresponding getByText assertion in this test. The negative test at line 530 also passes vacuously because isBilledCategory is false for TRACE_METRIC_BYTE in DATA_CATEGORY_INFO, meaning the field quotaTraceMetricBytes is never generated by CATEGORY_QUOTA_FIELDS — so the feature flag gating is never actually exercised by either test.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c3f80d6. Configure here.

Comment on lines +289 to +291
if (field.name.startsWith('quotaTraceMetricBytes') && !hasTraceMetricsBilling) {
return false;
}
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 feature flag gate for quotaTraceMetricBytes is dead code because the field is never generated due to its data category having isBilledCategory: false.
Severity: MEDIUM

Suggested Fix

To make the feature functional, change isBilledCategory to true for the TRACE_METRIC_BYTE data category in constants/index.tsx. Additionally, add a test case that asserts the 'Metrics (Bytes)' option is visible when the feature flag is enabled.

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/app/views/settings/account/notifications/notificationSettingsByType.tsx#L289-L291

Potential issue: The feature flag gate intended to control the visibility of the
'Metrics (Bytes)' notification setting will never execute. The field it checks for,
`quotaTraceMetricBytes`, is never generated because the field generation logic filters
for data categories with `isBilledCategory: true`. However, the `TRACE_METRIC_BYTE`
category is configured with `isBilledCategory: false`, causing it to be filtered out
before the feature flag check is ever reached. As a result, the feature is
non-functional, and the setting will not appear for users even when the flag is enabled.
This is corroborated by a missing assertion in the test suite for the positive case
where the flag is enabled.

Did we get this right? 👍 / 👎 to inform future reviews.

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.

will be added in a separate PR i'm gating it first

@brendanhsentry brendanhsentry merged commit d6d1381 into master Apr 6, 2026
77 checks passed
@brendanhsentry brendanhsentry deleted the brendanhsentry/feat/notifications-trace-metric-bytes-fe branch April 6, 2026 21:53
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
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.

2 participants