mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Fixes for pending period (#81718)
This commit is contained in:
parent
f2936d6695
commit
e1197641f3
@ -57,7 +57,7 @@ const forValidationOptions = (evaluateEvery: string): RegisterOptions => ({
|
||||
const millisEvery = parsePrometheusDuration(evaluateEvery);
|
||||
return millisFor >= millisEvery
|
||||
? true
|
||||
: 'For duration must be greater than or equal to the evaluation interval.';
|
||||
: 'Pending period must be greater than or equal to the evaluation interval.';
|
||||
} catch (err) {
|
||||
// if we fail to parse "every", assume validation is successful, or the error messages
|
||||
// will overlap in the UI
|
||||
|
@ -82,7 +82,7 @@ export const RulesForGroupTable = ({ rulesWithoutRecordingRules }: { rulesWithou
|
||||
},
|
||||
{
|
||||
id: 'for',
|
||||
label: 'For',
|
||||
label: 'Pending period',
|
||||
renderCell: ({ data: { forDuration } }) => {
|
||||
return <>{forDuration}</>;
|
||||
},
|
||||
|
@ -72,7 +72,7 @@ const EvaluationBehaviorSummary = ({ rule }: EvaluationBehaviorSummaryProps) =>
|
||||
|
||||
// recording rules don't have a for duration
|
||||
if (!isRecordingRulerRule(rule.rulerRule)) {
|
||||
forDuration = rule.rulerRule?.for;
|
||||
forDuration = rule.rulerRule?.for ?? '0s';
|
||||
}
|
||||
|
||||
return (
|
||||
@ -82,11 +82,10 @@ const EvaluationBehaviorSummary = ({ rule }: EvaluationBehaviorSummaryProps) =>
|
||||
Every {every}
|
||||
</DetailsField>
|
||||
)}
|
||||
{forDuration && (
|
||||
<DetailsField label="For" horizontal={true}>
|
||||
|
||||
<DetailsField label="Pending period" horizontal={true}>
|
||||
{forDuration}
|
||||
</DetailsField>
|
||||
)}
|
||||
|
||||
{lastEvaluation && !isNullDate(lastEvaluation) && (
|
||||
<DetailsField label="Last evaluation" horizontal={true}>
|
||||
|
@ -330,9 +330,7 @@ export function alertingRulerRuleToRuleForm(
|
||||
> {
|
||||
const defaultFormValues = getDefaultFormValues();
|
||||
|
||||
const [forTime, forTimeUnit] = rule.for
|
||||
? parseInterval(rule.for)
|
||||
: [defaultFormValues.forTime, defaultFormValues.forTimeUnit];
|
||||
const [forTime, forTimeUnit] = rule.for ? parseInterval(rule.for) : [0, 's'];
|
||||
|
||||
const [keepFiringForTime, keepFiringForTimeUnit] = rule.keep_firing_for
|
||||
? parseInterval(rule.keep_firing_for)
|
||||
|
@ -229,8 +229,8 @@ export const getAlertInfo = (alert: RulerRuleDTO, currentEvaluation: string): Al
|
||||
if (isAlertingRulerRule(alert)) {
|
||||
return {
|
||||
alertName: alert.alert,
|
||||
forDuration: alert.for ?? '1m',
|
||||
evaluationsToFire: getNumberEvaluationsToStartAlerting(alert.for ?? '1m', currentEvaluation),
|
||||
forDuration: alert.for ?? '0s',
|
||||
evaluationsToFire: getNumberEvaluationsToStartAlerting(alert.for ?? '0s', currentEvaluation),
|
||||
};
|
||||
}
|
||||
return emptyAlert;
|
||||
|
Loading…
Reference in New Issue
Block a user