Skip to content

fix(dashboard): Allow failure_rate in span aggregate functions#1295

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-1cz-failure-rate-agg
Open

fix(dashboard): Allow failure_rate in span aggregate functions#1295
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-1cz-failure-rate-agg

Conversation

@sentry

@sentry sentry Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

This PR addresses CLI-1CZ by adding failure_rate to the SPAN_AGGREGATE_FUNCTIONS array in src/types/dashboard.ts.

Previously, attempting to use failure_rate as an aggregate function for span-based dashboard widgets would result in a ValidationError: Unknown aggregate function "failure_rate" because it was not included in the allowlist for span aggregates.

Adding failure_rate to SPAN_AGGREGATE_FUNCTIONS resolves this validation error, enabling its correct usage in span queries.

Fixes CLI-1CZ

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1295/

Built to branch gh-pages at 2026-07-25 10:41 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 5497 uncovered lines.
❌ Project coverage is 81.74%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    81.75%    81.74%    -0.01%
==========================================
  Files          428       428         —
  Lines        30106     30106         —
  Branches     19593     19593         —
==========================================
+ Hits         24611     24609        -2
- Misses        5495      5497        +2
- Partials      2054      2055        +1

Generated by Codecov Action

@sentry
sentry Bot marked this pull request as ready for review July 25, 2026 10:49
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Jul 25, 2026

@cursor cursor Bot left a comment

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.

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.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5b3fa1d. Configure here.

Comment thread src/types/dashboard.ts
"p100",
"eps",
"epm",
"failure_rate",

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.

Duplicate failure_rate in discover list

Low Severity

Adding failure_rate to SPAN_AGGREGATE_FUNCTIONS also pulls it into DISCOVER_AGGREGATE_FUNCTIONS via the spread, while the discover-only list still keeps an explicit failure_rate entry. That leaves a duplicate in the combined allowlist and surfaces failure_rate twice in discover/error-events validation error messages.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5b3fa1d. Configure here.

Comment thread src/types/dashboard.ts
"p100",
"eps",
"epm",
"failure_rate",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Bug: The DISCOVER_AGGREGATE_FUNCTIONS array contains a duplicate "failure_rate" entry, which causes it to appear twice in error messages for invalid aggregate functions.
Severity: LOW

Suggested Fix

Remove the explicit "failure_rate" entry from the DISCOVER_AGGREGATE_FUNCTIONS array definition around line 273 in src/types/dashboard.ts, as it is already included via the spread of SPAN_AGGREGATE_FUNCTIONS.

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: src/types/dashboard.ts#L255

Potential issue: The `DISCOVER_AGGREGATE_FUNCTIONS` array contains a duplicate entry for
`"failure_rate"`. This happens because `SPAN_AGGREGATE_FUNCTIONS`, which now includes
`"failure_rate"`, is spread into the array, and then `"failure_rate"` is explicitly
added again. While this does not cause functional issues or validation failures due to
how `Array.includes()` and Zod's `enum` work, it does result in a minor cosmetic issue.
If a user provides an invalid aggregate function, the resulting error message will list
`"failure_rate"` twice.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants