Skip to content

Monitors API

Evaluation monitors (T186.010, features.evaluation_monitors). monitors:read lists a session’s teams’ monitors and monitors:manage changes those of the teams it administers; monitors:global (admin, and read-only viewer) widens either to every team. A team whose plan lacks evaluation_monitors has none.

GET /api/v1/admin/monitors · operation listMonitors

The evaluation monitors the session may see (those declared in YAML read-only, stored ones with their version), each with its effective values, its state and a link to what it judged; the counts by state; the monitor types, bounds and vocabulary; and the teams the session may write. Requires evaluation_monitors (with evaluation_results) and monitors:read. A session reads the monitors of its teams whose plan includes evaluation_monitors, and of every team with monitors:global. A state written while the team was in another organization is shown as never judged.

Authentication: adminSession

Parameters

Name In Type Description
team query string Only this team’s monitors
evaluator_id query string Only the monitors of this evaluator
evaluation query string Only the monitors that name this evaluation
type query MonitorType
state query string, one of "ok", "warn", "alert", "paused" Only the monitors in this state; paused is a disabled monitor

Responses

Status Description Body
200 Monitors, summary and vocabulary application/json: MonitorList
403 Model not allowed application/json: Error
404 Feature disabled application/json: Error

POST /api/v1/admin/monitors · operation createMonitor

Create a stored monitor. The gateway assigns the ID (mon_ and 20 hexadecimal characters); a body with an id is refused. Requires monitors:manage over the monitor’s team (403 team_forbidden otherwise) and the team’s plan to include evaluation_monitors and evaluation_results (403 entitlement_forbidden). An evaluator_id must be an evaluator of the same team, and every channel must exist, take evaluation_monitor_alert or evaluation_monitor_recovered and be open to the team (422, the same answer for a missing one and one of another tenant). A span_query monitor needs trace_query and span_store. At most evaluation.monitors.max_per_team monitors per team, YAML and stored together (409 monitor_limit). Audited as monitor.create.

Authentication: adminSession

Parameters

Name In Type Description
X-CSRF-Token header string, required Token returned by admin login/session; required with the same-origin session cookie for writes.

Request body (required)

Responses

Status Description Body
201 The stored monitor application/json: MonitorView
400 Invalid input application/json: Error
403 Model not allowed application/json: Error
404 Feature disabled application/json: Error
409 monitor_limit —
422 invalid_monitor: the monitor, its team, its evaluator or one of its channels is invalid —

POST /api/v1/admin/monitors/backtest · operation backtestMonitor

Replay a monitor that may not be stored yet over the last evaluation.monitors.backtest_days days (7 by default), in its own every steps: how many times it would have entered alert and warn and recovered, starting from ok, with the transitions and a series for the chart. It writes nothing and notifies no one. The monitor passes the same checks as a create, so a session replays only what it may store; with an id, the monitor being edited keeps the channels it has. The replay applies the scheduler’s own rule to the same per-step counts, so it counts what the scheduler would have recorded. An evaluator_health monitor replays the degraded rule only (blocked periods are not kept in history). Also returns the body a webhook channel would receive.

Authentication: adminSession

Parameters

Name In Type Description
X-CSRF-Token header string, required Token returned by admin login/session; required with the same-origin session cookie for writes.

Request body (required)

  • application/json: Monitor and object
    • All of (1): Monitor
    • All of (2): object
      • version (integer (int64))

Responses

Status Description Body
200 The replay application/json: object
400 Invalid input application/json: Error
403 Model not allowed application/json: Error
404 Feature disabled application/json: Error
422 invalid_monitor, query_too_broad (a term of the query matches more traces than one query holds in the range) or query_too_costly —
503 analytics_store_unavailable or storage_unavailable —

Response 200 fields:

GET /api/v1/admin/monitors/channels · operation listMonitorChannels

The alert channels a monitor of one team may name: enabled, subscribed to evaluation_monitor_alert or evaluation_monitor_recovered, and open to the team (rule_teams, or rule_organizations with the team’s organization). A team outside the session’s reach gets an empty list, as a team with no channel does. delivery is false while alert_channels is off.

Authentication: adminSession

Parameters

Name In Type Description
team query string, required

Responses

Status Description Body
200 Channels application/json: object
403 Model not allowed application/json: Error
404 Feature disabled application/json: Error

Response 200 fields:

  • application/json: object

GET /api/v1/admin/monitors/{id} · operation getMonitor

One monitor with its state, its last 100 transitions (those recorded in the team’s current organization), the channels its team may name, the monitor as a YAML evaluation.monitors.items entry, and the body a webhook channel would receive. A monitor outside the session’s scope answers 404.

Authentication: adminSession

Parameters

Name In Type Description
id path string, required

Responses

Status Description Body
200 The monitor application/json: object
403 Model not allowed application/json: Error
404 Monitor not found, outside the session’s scope, or feature disabled —

Response 200 fields:

  • application/json: object
    • monitor (MonitorView, required)
    • transitions (array of MonitorTransition, required)
    • yaml (string, required) — The monitor as configuration: paste it under evaluation.monitors.items and it becomes a declared, read-only monitor with the same ID and behavior.
    • channels (array of MonitorChannelChoice, required)
    • example_payload (MonitorEventPayload, required)

PUT /api/v1/admin/monitors/{id} · operation updateMonitor

Replace a stored monitor at its version (409 version_conflict). Its team never changes (422). A monitor outside the session’s scope answers 404; a YAML monitor answers 409 yaml_managed to a session that can see it. A channel the monitor already has may stay even when the editor could not add it. The edited monitor is judged afresh: its state returns to ok, its alert on the Alerts screen is resolved and it is due at once. Audited as monitor.update.

Authentication: adminSession

Parameters

Name In Type Description
id path string, required
X-CSRF-Token header string, required Token returned by admin login/session; required with the same-origin session cookie for writes.

Request body (required)

  • application/json: Monitor and object
    • All of (1): Monitor
    • All of (2): object
      • version (integer (int64), required)

Responses

Status Description Body
200 The stored monitor application/json: MonitorView
400 Invalid input application/json: Error
403 Model not allowed application/json: Error
404 Monitor not found, outside the session’s scope, or feature disabled —
409 version_conflict or yaml_managed —
422 invalid_monitor —

DELETE /api/v1/admin/monitors/{id} · operation deleteMonitor

Delete a stored monitor at its version, with its state; its alert on the Alerts screen is resolved. Its transitions stay as history for 90 days. Audited as monitor.delete.

Authentication: adminSession

Parameters

Name In Type Description
id path string, required
version query integer (int64), required, min 1 The monitor’s current version; a stale one answers 409 version_conflict.
X-CSRF-Token header string, required Token returned by admin login/session; required with the same-origin session cookie for writes.

Responses

Status Description Body
204 Deleted —
400 Invalid input application/json: Error
403 Model not allowed application/json: Error
404 Monitor not found, outside the session’s scope, or feature disabled —
409 version_conflict or yaml_managed —

POST /api/v1/admin/monitors/{id}/mute · operation muteMonitor

Silence a monitor’s notifications for a duration, or end the mute with an empty duration. The monitor keeps being judged and its transitions keep being recorded (marked muted). It applies to YAML monitors too: a mute is operational state, not configuration. Audited as monitor.mute or monitor.unmute.

Authentication: adminSession

Parameters

Name In Type Description
id path string, required
X-CSRF-Token header string, required Token returned by admin login/session; required with the same-origin session cookie for writes.

Request body (required)

  • application/json: object
    • duration (string) — A Go duration from 1m to 720h; empty ends the mute.

Responses

Status Description Body
200 The monitor’s state application/json: object
400 Invalid input application/json: Error
403 Model not allowed application/json: Error
404 Monitor not found, outside the session’s scope, or feature disabled —

Response 200 fields:

POST /api/v1/admin/monitors/{id}/test · operation testMonitor

Queue a test notification of the monitor for its channels: the evaluation_monitor_alert event with kind test, signed and delivered through the same outbox as a real alert, so its outcome shows in the channel’s deliveries. It changes no state and opens no alert. 422 no_channel when the monitor has no channel that takes the event and is open to its team, or alert_channels is off.

Authentication: adminSession

Parameters

Name In Type Description
id path string, required
X-CSRF-Token header string, required Token returned by admin login/session; required with the same-origin session cookie for writes.

Responses

Status Description Body
202 Queued application/json: object
403 Model not allowed application/json: Error
404 Monitor not found, outside the session’s scope, or feature disabled —
422 no_channel —

Response 202 fields:

  • application/json: object
    • queued (integer, required)
    • channels (array of string, required)
    • transition_id (string, required)

m7gtw[email protected]