fix(dashboard): Allow failure_rate in span aggregate functions#1295
fix(dashboard): Allow failure_rate in span aggregate functions#1295sentry[bot] wants to merge 1 commit into
Conversation
|
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 5497 uncovered lines. 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 +1Generated by Codecov Action |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.
| "p100", | ||
| "eps", | ||
| "epm", | ||
| "failure_rate", |
There was a problem hiding this comment.
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)
Reviewed by Cursor Bugbot for commit 5b3fa1d. Configure here.
| "p100", | ||
| "eps", | ||
| "epm", | ||
| "failure_rate", |
There was a problem hiding this comment.
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.


This PR addresses CLI-1CZ by adding
failure_rateto theSPAN_AGGREGATE_FUNCTIONSarray insrc/types/dashboard.ts.Previously, attempting to use
failure_rateas an aggregate function for span-based dashboard widgets would result in aValidationError: Unknown aggregate function "failure_rate"because it was not included in the allowlist for span aggregates.Adding
failure_ratetoSPAN_AGGREGATE_FUNCTIONSresolves 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.