Skip to main content
A monitor should watch a signal the application actually emits. Start with an observed service and a threshold that matters to its users.
Tell your agent what would count as a problem. It can suggest a threshold based on available data and ask you to decide before enabling notifications.
Native monitors evaluate the traces, logs and metrics you instrument with Struct. Use struct monitors to configure them. Auto Monitors, configured with struct automonitors, uses pull requests and deploys to manage monitors.You need telemetry arriving in the workspace and permission to configure monitors. A temporary login from struct init can do this while its workspace is active; observability and workspace activation must also be enabled.

1. Choose a signal

Use the service name returned by the first command. Check for an existing monitor before creating another: create is not an update. Use struct telemetry guide [topic] for worked condition documents you can adapt directly:
  • heartbeat — detect silent or stopped services (aggregation: "count()" with op: "<", value: 1; an empty count evaluates to 0, so silence reliably fires without depending on noDataBehavior).
  • freshness — alert when a periodic job has not succeeded recently (combines max(timestamp) with count() < 1).
  • observation_health — alert when a configured Observation fails to bind or poll on any running SDK stream (set noDataBehavior: "ignore").
  • slo_burn, anomaly, time_to_full, shift, each_new_row, per_entity, presentation.
Wait until a brand-new signal has reported at least one full window before creating a < floor or heartbeat monitor, or it will fire immediately on the empty history before capture began.

2. Define and preview the monitor

This example measures the 95th percentile of span duration for checkout-api over five minutes, evaluated every minute. Replace the service name and the illustrative 1,000 ms threshold with values appropriate for your application. It covers all spans for that service; add to the query’s filter (for example AND span.name = 'POST /checkout') if you want one operation. Monitors are written as conditions in the query language; they hold no SQL.Save as monitor.json:
Inspect the returned query result and any query.error. With --json, preview can return an error in the document while the command exits successfully. If the filter matches no recent spans, exercise the service or correct the filter before continuing. Preview is a historical calculation, not evidence that a scheduled evaluation or notification has happened.

3. Save and inspect

Keep the returned monitor ID. Substitute it for MONITOR_ID below:
Check the configuration, chart values and any queryError. A firing is recorded only when the condition is met; an empty firing history is not proof that it evaluated successfully. Allow for the evaluation cadence and use a controlled test workload if you need to prove a threshold crossing. Record what happened rather than lowering a production threshold just to make an alert.This example has no delivery destinations and does not send Slack or email. An unclaimed workspace also blocks outbound notifications and background AI. After claim, configure the desired destination separately and verify delivery before calling alert routing complete.

Update or remove

Use struct monitors update MONITOR_ID --file changes.json to change only the fields in that file. Before retrying a create after a lost response, inspect struct monitors list --json to avoid duplicates. Delete a disposable test monitor with struct monitors delete MONITOR_ID --yes when it is no longer needed; this also closes its open firings.An unclaimed workspace permits ten non-deleted monitors, including disabled ones. workspace_paused means a person must claim the workspace before queries, previews or new configuration changes can continue. Existing configuration and firing history remain readable.