Skip to content

Rule🔗

Definition🔗

class Rule:
    annotations: typing.Optional[dict[str, str]]
    condition: str
    data: list[alerting.Query]
    exec_err_state: typing.Literal["OK", "Alerting", "Error"]
    folder_uid: str
    # The amount of time, in seconds, for which the rule must be breached for the rule to be considered to be Firing.
    # Before this time has elapsed, the rule is only considered to be Pending.
    for_val: str
    id_val: typing.Optional[int]
    is_paused: typing.Optional[bool]
    labels: typing.Optional[dict[str, str]]
    no_data_state: typing.Literal["Alerting", "NoData", "OK"]
    notification_settings: typing.Optional[alerting.NotificationSettings]
    org_id: int
    provenance: typing.Optional[alerting.Provenance]
    record: typing.Optional[alerting.RecordRule]
    rule_group: str
    title: str
    uid: typing.Optional[str]
    updated: typing.Optional[str]

Methods🔗

to_json🔗

Converts this object into a representation that can easily be encoded to JSON.

def to_json() -> dict[str, object]

from_json🔗

Builds this object from a JSON-decoded dict.

@classmethod
def from_json(data: dict[str, typing.Any]) -> typing.Self

See also🔗