Files
grafana/apps/alerting/rules/kinds/v0alpha1/alertRule_spec.cue
T
Moustafa Baiou cb7abbaa0f Alerting: Rename expression elements of Rules APIs (#110914)
This renames `data` to `expressions` for clarity in the rules apis.

Also makes certain fields that are redundant optional in the case of pure expressions, so that users don't have to specify them when they are not needed (e.g. not datasource queries).
2025-09-12 22:15:55 +00:00

40 lines
1.2 KiB
CUE

package v0alpha1
import "strings"
NoDataState: *"NoData" | "Ok" | "Alerting" | "KeepLast"
ExecErrState: *"Error" | "Ok" | "Alerting" | "KeepLast"
#TimeIntervalRef: string // TODO(@moustafab): validate regex for time interval ref
// FIXME: the For and KeepFiringFor types should be using the AlertRulePromDuration type, but there seems to be an issue with the generator
AlertRuleSpec: #RuleSpec & {
annotations?: {
[string]: TemplateString
}
"for"?: string & #PromDuration
keepFiringFor?: string & #PromDuration
missingSeriesEvalsToResolve?: int & >=0
noDataState: NoDataState
execErrState: ExecErrState
notificationSettings?: #NotificationSettings
panelRef?: #PanelRef
}
#PanelRef: {
dashboardUID: string & strings.MinRunes(1) & =~"^[a-zA-Z0-9_-]+$"
panelID: int & >0
}
// TODO(@moustafab): this should be imported from the notifications package
#NotificationSettings: {
receiver: string
groupBy?: [...string]
groupWait?: #PromDuration
groupInterval?: #PromDuration
repeatInterval?: #PromDuration
muteTimeIntervals?: [...#TimeIntervalRef]
activeTimeIntervals?: [...#TimeIntervalRef]
}