RollingCapRule
A cap on time in statuses inside a window: “60 hours in 7 operator days”, “100 hours in 672 hours”.
import type { RollingCapRule } from "@northguild/gmt";Members
Section titled “Members”| Member | Type | Description |
|---|---|---|
label | string | The caller’s name for the rule. The report is keyed by it; labels must be unique. |
severity? | "violation" | "advisory" (DutySeverity) | Whether a failure is a violation or an advisory. |
kind | "rollingCap" | Selects this rule kind. |
statuses | S[] | The statuses whose time is capped. |
cap | string | The most time allowed in the window, a positive ISO 8601 duration of exact time. |
window | Period | The span the cap is counted over. |
reset? | Reset<S> (Reset) | A rest that starts the count again, as a long rest that restarts a cycle does. |
precondition? | object | A rest the window must hold before its time passes beforeHours. |
precondition.restStatuses | S[] | The statuses the rest is made of. |
precondition.minimum | string | How long the rest must be, a positive ISO 8601 duration of exact time. |
precondition.beforeHours | string | The most time allowed before that rest, a positive ISO 8601 duration of exact time. |
Definition
Section titled “Definition”type RollingCapRule<S extends string = string> = { /** The caller's name for the rule. The report is keyed by it; labels must be unique. */ label: string; /** * Whether a failure is a violation or an advisory. * * @defaultValue `"violation"`. */ severity?: DutySeverity; /** Selects this rule kind. */ kind: "rollingCap"; /** The statuses whose time is capped. */ statuses: S[]; /** The most time allowed in the window, a positive ISO 8601 duration of exact time. */ cap: string; /** The span the cap is counted over. */ window: Period; /** * A rest that starts the count again, as a long rest that restarts a cycle does. * * @defaultValue None. Only the window limits the count. */ reset?: Reset<S>; /** * A rest the window must hold before its time passes `beforeHours`. * * @defaultValue None. The cap applies from the start of the window. */ precondition?: { /** The statuses the rest is made of. */ restStatuses: S[]; /** How long the rest must be, a positive ISO 8601 duration of exact time. */ minimum: string; /** The most time allowed before that rest, a positive ISO 8601 duration of exact time. */ beforeHours: string; };};