New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(alerts): Metric alert rule save error msg when missing rule name #34729
fix(alerts): Metric alert rule save error msg when missing rule name #34729
Conversation
@@ -157,6 +157,11 @@ class TriggerFormContainer extends Component<TriggerFormContainerProps> { | |||
}; | |||
|
|||
getThresholdUnits(aggregate: string, comparisonType: AlertRuleComparisonType) { | |||
// cls is a number not a measurement of time | |||
if (aggregate.includes('measurements.cls')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@taylangocmen Using the measurementType()
function might be better as we add more non-duration based measurements to alerts in the future (e.g. Mobile Vitals):
sentry/static/app/utils/discover/fields.tsx
Lines 793 to 798 in e0fe30d
export function measurementType(field: string): MeasurementType { | |
if (MEASUREMENTS.hasOwnProperty(field)) { | |
return MEASUREMENTS[field]; | |
} | |
return 'number'; | |
} |
if (aggregate.includes('measurements.cls')) { | |
if (measurementType(aggregate) !== 'duration') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just measurementType(aggregate)
would ignore the non-vital type aggregates like transaction.duration
, so a combination of the two is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@taylangocmen Ah. In that case, aggregateFunctionOutputType()
might be an option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually measurementType(aggregate)
wouldn't work on alert MEASUREMENTS
fields
because the alert aggregate includes the aggregate function ie. percentile(measurements.lcp,0.5)'
or p99(measurements.lcp)
vs just measurements.lcp
substring matching on every aggregate here isn't worth it.
This restores the control state to alert rule name in the metric alert rule editor. Updates the error message with the missing fields. Also removes the
ms
from the Cumulative Layout Shift error trigger thresholds.V3 metric example:
non-V3 metric example:
Error messages: