Alerting: Do not check evaluation interval for external rulers (#89354)

This commit is contained in:
Gilles De Mey 2024-06-19 16:28:46 +02:00 committed by GitHub
parent 86ac40418d
commit 64e134c601
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -338,7 +338,8 @@ export function EditCloudGroupModal(props: ModalProps): React.ReactElement {
</Stack>
</Field>
{checkEvaluationIntervalGlobalLimit(watch('groupInterval')).exceedsLimit && (
{/* if we're dealing with a Grafana-managed group, check if the evaluation interval is valid / permitted */}
{isGrafanaManagedGroup && checkEvaluationIntervalGlobalLimit(watch('groupInterval')).exceedsLimit && (
<EvaluationIntervalLimitExceeded />
)}

View File

@ -7,6 +7,7 @@ import { Icon, Tooltip, useStyles2 } from '@grafana/ui/src';
import { CombinedRule } from '../../../../../types/unified-alerting';
import { checkEvaluationIntervalGlobalLimit } from '../../utils/config';
import { isGrafanaRulerRule } from '../../utils/rules';
interface RuleConfigStatusProps {
rule: CombinedRule;
@ -14,11 +15,11 @@ interface RuleConfigStatusProps {
export function RuleConfigStatus({ rule }: RuleConfigStatusProps) {
const styles = useStyles2(getStyles);
const isGrafanaManagedRule = isGrafanaRulerRule(rule.rulerRule);
const { exceedsLimit } = useMemo(
() => checkEvaluationIntervalGlobalLimit(rule.group.interval),
[rule.group.interval]
);
const exceedsLimit = useMemo(() => {
return isGrafanaManagedRule ? checkEvaluationIntervalGlobalLimit(rule.group.interval).exceedsLimit : false;
}, [rule.group.interval, isGrafanaManagedRule]);
if (!exceedsLimit) {
return null;