Monitors
Monitor Model
Fields
Field | Type | Description |
|---|---|---|
object | "monitor" | |
id | string | Unique identifier, prefixed with mtr_. |
slug | string | URL-safe identifier for the monitor. |
team_id | string | |
project_id | string | |
metric_id | string | The metric this monitor watches. Fixed for the life of the monitor. |
name | string | |
description | string | null | What this monitor watches for. |
status | | paused was switched off by you and disabled by its expiry. Change it with pause and resume. |
expires_at | | null | When the monitor stops checking; null when it does not expire. |
statistic | | What is computed over each window. |
operator | | How the statistic is compared with threshold_value. |
threshold_value | number | |
empty_window_handling | | What the statistic reads when the window holds no data. Always zero for count, sum and
count_unique. |
window_type | | |
window_minutes | number | null | Length of a rolling window in whole minutes. Null for all_time. |
scope | | |
series_filters | MonitorSeriesFilters | |
trigger_type | | |
sustained_minutes | number | null | How long matches must hold before an alert opens. Set only for sustained. |
repeat_count | number | null | How many matching checks open an alert. Set only for repeated. |
repeat_window_minutes | number | null | The window those matching checks must fall within. Set only for repeated. |
schedule_cron | string | Five-field cron expression, in UTC, setting when the monitor checks. At most once a minute. |
alert_mode | | |
next_check_at | | null | The next scheduled check. Null while the monitor is paused or disabled. |
last_slot_at | | null | The most recent scheduled check that was fully applied. |
created_at | | |
updated_at | | |
recent_alerts | [] | The most recent alerts this monitor raised. |
series_states | [] | The current state of each target the monitor checks. |
Monitor Preview Model
Fields
Field | Type | Description |
|---|---|---|
object | "monitor_preview" | |
is_ready | boolean | False while the window is not complete yet. verdicts is then empty. |
slot_at | | The check being previewed: the most recent slot on the monitor's schedule. |
window_start_at | | |
window_end_at | | |
complete_through_at | | null | Everything before this instant is final. The window is ready once this reaches slot_at. Null
when no statement can be made. |
verdicts | [] | |
trigger_note | string | null | For sustained and repeated triggers, a reminder that the preview shows one check, not
whether the trigger would open an alert. Null otherwise. |
Monitor Verdict Model
Fields
Field | Type | Description |
|---|---|---|
series_hash | string | |
series_label | string | null | The series name for each_series. Null for total and any_series. |
value | number | null | The statistic over the window. Null when the window gave nothing to compare. |
verdict | |
Monitor Series State Model
Fields
Field | Type | Description |
|---|---|---|
series_hash | string | |
is_triggered | boolean | For spanning monitors, whether an alert is open. For instant monitors, whether the
condition has fired and not yet cleared, which keeps it from firing again. |
last_value | number | null | The statistic at the last check. Null when that window gave nothing to compare. |
last_check_status | | |
last_check_reason | string | null | Why the last check had no verdict, when it had none. |
last_slot_at | | null | The most recent scheduled check applied to this target. |
last_triggered_at | | null | When this target last opened an alert. |
sustained_started_at | | null | For sustained triggers, when the current run of matches began. |
repeat_matches | { matched_at: ; }[] | For repeated triggers, the matching checks inside the current window. |
Monitor Draft Model
Fields
Field | Type | Description |
|---|---|---|
outcome | "draft" | "clarification" | draft when the description was enough for a rule, clarification when it was not. |
draft | | Record<string, never> | The drafted rule. Empty for a clarification. Review it before creating the monitor. |
assumptions | string[] | What the draft assumed that the description did not say, one sentence each. |
question | string | null | For a clarification, what to add to the description. Null for a draft. |
Monitor Draft Rule Model
Fields
Field | Type |
|---|---|
name | string |
statistic | |
operator | |
threshold_value | number |
empty_window_handling | |
window_type | |
window_minutes | number | null |
scope | |
series_filters | MonitorSeriesFilters |
trigger_type | |
sustained_minutes | number | null |
repeat_count | number | null |
repeat_window_minutes | number | null |
schedule_cron | string |
alert_mode | |
List Monitors
Endpoint
List the monitors watching a project's metrics.
/v1/projects/:project_id/monitors /v1/projects/:project_id/metrics/:metric_id/monitors Path Parameters
Field | Type | Description |
|---|---|---|
project_id | string | Unique identifier of the project. |
metric_id | string | Unique identifier of the metric. Only used by /v1/projects/:project_id/metrics/:metric_id/monitors. |
Query Parameters
Field | Type | Description |
|---|---|---|
order_by | string | Field the results are sorted by. Defaults to "name". Accepted values: "name","created_at". |
metric_id | string | Return only monitors watching this metric. |
status | string | Return only monitors in this state. Accepted values: "active","paused","disabled". |
limit | number | Defaults to 25. Minimum: 1. Maximum: 200. |
after | string | Cursor from pagination.next_cursor of a previous response. Returns the resources after that page. |
before | string | Cursor from pagination.prev_cursor of a previous response. Returns the resources before that page. |
sort | string | Defaults to "asc". Accepted values: "asc","desc". |
Response
{
message: string;
data: Monitor[];
status: 200;
error: null;
pagination: Pagination;
endpoint: string;
} Retrieve Monitor
Endpoint
Retrieve a single monitor.
/v1/projects/:project_id/metrics/:metric_id/monitors/:monitor_id Path Parameters
Field | Type | Description |
|---|---|---|
project_id | string | Unique identifier of the project. |
metric_id | string | Unique identifier of the metric. |
monitor_id | string | Unique identifier of the monitor. |
Response
{
message: string;
data: Monitor;
status: 200;
error: null;
pagination: null;
endpoint: string;
} Create Monitor
Endpoint
Create a monitor that raises alerts when a metric meets a condition.
/v1/projects/:project_id/metrics/:metric_id/monitors Path Parameters
Field | Type | Description |
|---|---|---|
project_id | string | Unique identifier of the project. |
metric_id | string | Unique identifier of the metric. |
Request Body
Field | Type | Requirement | Description |
|---|---|---|---|
name | string | Optional | Name shown for this monitor. Minimum length: 2. Maximum length: 64. |
description | string | null | Optional | What this monitor watches for. |
status | string | Optional | Whether the monitor starts checking immediately or switched off. disabled is not accepted: the system uses it to record that it stopped the monitor itself. Defaults to "active". Accepted values: "active","paused". |
expires_at | | null | Optional | When the monitor stops checking. Leave null for no expiry. |
statistic | | Required | What is computed over each window. count, sum and count_unique measure how much happened; the others read a value from the window's observations. |
operator | | Required | How the statistic is compared with threshold_value. |
threshold_value | number | Required | The value the statistic is compared with. count equal to 0 alerts when no data arrives. |
empty_window_handling | | Optional | What the statistic reads when the window holds no data. zero reads 0. no_value reads nothing, so that check neither opens nor closes an alert. |
window_type | | Optional | rolling reads the window_minutes before each check. all_time reads everything from the start of the project. Defaults to "rolling". |
window_minutes | integer | null | Optional | Length of a rolling window in whole minutes (1 to 525600). Null for all_time. |
scope | | Optional | total checks the whole feed as one value. any_series keeps one alert open while any series matches. each_series checks every series separately. Defaults to "total". |
series_filters | object | Optional | Narrows which of the metric's series this monitor watches. Property values may use * wildcards. Empty watches every series. |
series_filters.include | object[] | Optional | Only series matching one of these property sets are watched. |
series_filters.exclude | object[] | Optional | Series matching one of these property sets are ignored. |
trigger_type | | Optional | When a match opens an alert. immediate on the first matching check, sustained once matches have held for sustained_minutes, repeated after repeat_count matching checks within repeat_window_minutes. Defaults to "immediate". |
sustained_minutes | integer | null | Optional | How long matches must hold before an alert opens, in whole minutes. Only for sustained. |
repeat_count | integer | null | Optional | How many matching checks open an alert. Only for repeated. |
repeat_window_minutes | integer | null | Optional | The window, in whole minutes, those matching checks must fall within. Only for repeated. |
schedule_cron | string | Optional | Five-field cron expression, in UTC, setting when the monitor checks. Defaults to "* * * * *". Minimum length: 1. Maximum length: 128. |
alert_mode | | Optional | spanning keeps an alert open until the condition clears. instant opens and ends it at once. Defaults to "spanning". |
metric_id | string | Optional | Metric to watch. Optional when using the /metrics/:metric/monitors route. |
Response
{
message: string;
data: Monitor;
status: 201;
error: null;
pagination: null;
endpoint: string;
} Draft Monitor
Endpoint
Draft a monitor rule from a description in your own words.
/v1/projects/:project_id/metrics/:metric_id/monitors/draft Path Parameters
Field | Type | Description |
|---|---|---|
project_id | string | Unique identifier of the project. |
metric_id | string | Unique identifier of the metric. |
Request Body
Field | Type | Requirement | Description |
|---|---|---|---|
description | string | Required | The alert in your own words, for example Alert me if no data arrives for 10 minutes.. Minimum length: 1. Maximum length: 1000. |
Response
{
message: string;
data: MonitorDraft;
status: 200;
error: null;
pagination: null;
endpoint: string;
} Preview Monitor
Endpoint
Preview a monitor's rule on its most recent scheduled check, without saving or raising alerts.
/v1/projects/:project_id/metrics/:metric_id/monitors/preview Path Parameters
Field | Type | Description |
|---|---|---|
project_id | string | Unique identifier of the project. |
metric_id | string | Unique identifier of the metric. |
Request Body
Field | Type | Requirement | Description |
|---|---|---|---|
name | string | Optional | Name shown for this monitor. Minimum length: 2. Maximum length: 64. |
description | string | null | Optional | What this monitor watches for. |
status | string | Optional | Whether the monitor starts checking immediately or switched off. disabled is not accepted: the system uses it to record that it stopped the monitor itself. Defaults to "active". Accepted values: "active","paused". |
expires_at | | null | Optional | When the monitor stops checking. Leave null for no expiry. |
statistic | | Required | What is computed over each window. count, sum and count_unique measure how much happened; the others read a value from the window's observations. |
operator | | Required | How the statistic is compared with threshold_value. |
threshold_value | number | Required | The value the statistic is compared with. count equal to 0 alerts when no data arrives. |
empty_window_handling | | Optional | What the statistic reads when the window holds no data. zero reads 0. no_value reads nothing, so that check neither opens nor closes an alert. |
window_type | | Optional | rolling reads the window_minutes before each check. all_time reads everything from the start of the project. Defaults to "rolling". |
window_minutes | integer | null | Optional | Length of a rolling window in whole minutes (1 to 525600). Null for all_time. |
scope | | Optional | total checks the whole feed as one value. any_series keeps one alert open while any series matches. each_series checks every series separately. Defaults to "total". |
series_filters | object | Optional | Narrows which of the metric's series this monitor watches. Property values may use * wildcards. Empty watches every series. |
series_filters.include | object[] | Optional | Only series matching one of these property sets are watched. |
series_filters.exclude | object[] | Optional | Series matching one of these property sets are ignored. |
trigger_type | | Optional | When a match opens an alert. immediate on the first matching check, sustained once matches have held for sustained_minutes, repeated after repeat_count matching checks within repeat_window_minutes. Defaults to "immediate". |
sustained_minutes | integer | null | Optional | How long matches must hold before an alert opens, in whole minutes. Only for sustained. |
repeat_count | integer | null | Optional | How many matching checks open an alert. Only for repeated. |
repeat_window_minutes | integer | null | Optional | The window, in whole minutes, those matching checks must fall within. Only for repeated. |
schedule_cron | string | Optional | Five-field cron expression, in UTC, setting when the monitor checks. Defaults to "* * * * *". Minimum length: 1. Maximum length: 128. |
alert_mode | | Optional | spanning keeps an alert open until the condition clears. instant opens and ends it at once. Defaults to "spanning". |
metric_id | string | Optional | Metric to watch. Optional when using the /metrics/:metric/monitors route. |
Response
{
message: string;
data: MonitorPreview;
status: 200;
error: null;
pagination: null;
endpoint: string;
} Update Monitor
Endpoint
Change a monitor's rule, schedule, name, description or expiry.
/v1/projects/:project_id/metrics/:metric_id/monitors/:monitor_id Path Parameters
Field | Type | Description |
|---|---|---|
project_id | string | Unique identifier of the project. |
metric_id | string | Unique identifier of the metric. |
monitor_id | string | Unique identifier of the monitor. |
Request Body
Field | Type | Requirement | Description |
|---|---|---|---|
name | string | Optional | Name shown for this monitor. Minimum length: 2. Maximum length: 64. |
description | string | null | Optional | What this monitor watches for. |
expires_at | | null | Optional | When the monitor stops checking. Leave null for no expiry. |
statistic | | Optional | What is computed over each window. count, sum and count_unique measure how much happened; the others read a value from the window's observations. |
operator | | Optional | How the statistic is compared with threshold_value. |
threshold_value | number | Optional | The value the statistic is compared with. count equal to 0 alerts when no data arrives. |
empty_window_handling | | Optional | What the statistic reads when the window holds no data. zero reads 0. no_value reads nothing, so that check neither opens nor closes an alert. |
window_type | | Optional | rolling reads the window_minutes before each check. all_time reads everything from the start of the project. |
window_minutes | integer | null | Optional | Length of a rolling window in whole minutes (1 to 525600). Null for all_time. |
scope | | Optional | total checks the whole feed as one value. any_series keeps one alert open while any series matches. each_series checks every series separately. |
series_filters | object | Optional | Narrows which of the metric's series this monitor watches. Property values may use * wildcards. Empty watches every series. |
series_filters.include | object[] | Optional | Only series matching one of these property sets are watched. |
series_filters.exclude | object[] | Optional | Series matching one of these property sets are ignored. |
trigger_type | | Optional | When a match opens an alert. immediate on the first matching check, sustained once matches have held for sustained_minutes, repeated after repeat_count matching checks within repeat_window_minutes. |
sustained_minutes | integer | null | Optional | How long matches must hold before an alert opens, in whole minutes. Only for sustained. |
repeat_count | integer | null | Optional | How many matching checks open an alert. Only for repeated. |
repeat_window_minutes | integer | null | Optional | The window, in whole minutes, those matching checks must fall within. Only for repeated. |
schedule_cron | string | Optional | Five-field cron expression, in UTC, setting when the monitor checks. Minimum length: 1. Maximum length: 128. |
alert_mode | | Optional | spanning keeps an alert open until the condition clears. instant opens and ends it at once. |
Response
{
message: string;
data: Monitor;
status: 200;
error: null;
pagination: null;
endpoint: string;
} Pause Monitor
Endpoint
Pause a monitor so it stops checking.
/v1/projects/:project_id/metrics/:metric_id/monitors/:monitor_id/pause Path Parameters
Field | Type | Description |
|---|---|---|
project_id | string | Unique identifier of the project. |
metric_id | string | Unique identifier of the metric. |
monitor_id | string | Unique identifier of the monitor. |
Response
{
message: string;
data: Monitor;
status: 200;
error: null;
pagination: null;
endpoint: string;
} Resume Monitor
Endpoint
Resume a paused monitor so it checks on its schedule again.
/v1/projects/:project_id/metrics/:metric_id/monitors/:monitor_id/resume Path Parameters
Field | Type | Description |
|---|---|---|
project_id | string | Unique identifier of the project. |
metric_id | string | Unique identifier of the metric. |
monitor_id | string | Unique identifier of the monitor. |
Response
{
message: string;
data: Monitor;
status: 200;
error: null;
pagination: null;
endpoint: string;
} Delete Monitor
Endpoint
Delete a monitor.
/v1/projects/:project_id/metrics/:metric_id/monitors/:monitor_id Path Parameters
Field | Type | Description |
|---|---|---|
project_id | string | Unique identifier of the project. |
metric_id | string | Unique identifier of the metric. |
monitor_id | string | Unique identifier of the monitor. |
Response
{
message: string;
data: null;
status: 200;
error: null;
pagination: null;
endpoint: string;
} Referenced Types
ISODateString
An ISO 8601 date-time string returned at the JSON API boundary.
MonitorStatus
MonitorStatistic
What a monitor computes over its window. count, sum and count_unique measure how much
happened; the others read a value from the observations in the window.
MonitorOperator
MonitorEmptyWindowHandling
What a statistic reads when its window holds no data. zero reads 0; no_value reads nothing,
so the check neither opens nor closes an alert. count, sum and count_unique always use
zero.
MonitorWindowType
rolling reads the window_minutes before each check; all_time reads everything up to it.
MonitorScope
total checks the whole feed as one value. any_series opens one alert while any series
matches. each_series checks every series separately.
MonitorTriggerType
When a match opens an alert. immediate on the first matching check; sustained once matches
have held for sustained_minutes; repeated after repeat_count matches within
repeat_window_minutes.
MonitorAlertMode
spanning keeps an alert open until the condition clears; instant opens and ends it at once.
AlertEndReason
Why an alert ended. recovered: the condition cleared. instant: an instant alert, which ends
as it opens. monitor_changed: the monitor's rule was edited. monitor_paused /
monitor_expired: the monitor stopped. metric_rebuilt: the metric was rebuilt from its data.
resource_deleted: the metric or something it reads from is being deleted. target_removed: the
series no longer exists.
MonitorCheckStatus
The outcome of a target's most recent check. unknown means the slot was passed over without a
verdict, for example while the metric rebuilds; error means the read failed and is retried.
MonitorVerdict
One check's comparison. no_value means the window gave nothing to compare, which never opens or
closes an alert.