> ## Documentation Index
> Fetch the complete documentation index at: https://docs.struct.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Telemetry and monitoring

> Struct CLI reference: telemetry and monitoring.

Use the Struct CLI to inspect and configure the workspace from your terminal. Commands run with the permissions of the active login.

## Poll native firings

Run `struct monitors firings --json` to read open native firings across the workspace,
including monitors with no delivery destinations. Follow `hasMore` with `--page`
and track processed firing IDs. For recent history on one monitor, use
`struct monitors firings <monitor-id> --all --since 2h --json`.

## Native telemetry and monitors

[Instrument with Struct](https://docs.struct.ai/observability/instrumentation.md), then [create a telemetry monitor](https://docs.struct.ai/observability/monitors/create.md). `struct monitors` manages Struct's native rules over your telemetry; `struct automonitors` configures PR/deploy-driven Auto Monitors. Do not substitute one command family for the other.

An activated, active unclaimed workspace can use telemetry and native-monitor commands. While paused, configuration and existing firing history remain readable; query/preview/chart and mutation operations require claim. Pre-claim monitors have no outbound notifications or background AI, and at most ten non-deleted monitors may exist (disabled ones count).

| Command | What it does |
| - | - |
| `struct telemetry services` | List each service with telemetry records in the window, with the age of its newest trace, log and metric (`just now`, `5m ago`, `3h ago`, `2d ago`, or `none`). The window uses the records' own timestamps (when the service produced them), not when Struct received them. Looks back 24 hours; `--since <age, date or time>` changes that, for example `--since 7d` (1 minute to 30 days). Exits 1 with `no_telemetry` when no records fall in the window, so a setup script can wait on it. Any member can run it; it needs observability on for the workspace (`observability_not_enabled` otherwise). |
| `struct telemetry usage` | Workspace admins only. Show how much telemetry the workspace has sent Struct this calendar month (UTC), in metered bytes (each request's body after decompression; 1 GB is 1,000,000,000 bytes), with wire bytes, requests and total records (the tables break metered and wire bytes and requests down by signal and encoding; `--json` prints everything), then the plan, this month's usage against the included amount (near from 80%, over from 100%; only the free plan includes an amount), any monthly cap an admin set, and whether ingest is blocked, and why. `--month YYYY-MM` reads an earlier month (up to 24 months back); `--since <when>` (and `--until`) a range of up to 92 days. No prices. Exits 1 with `telemetry_usage_unavailable` or `telemetry_usage_busy` when usage can't be read, never zeros; anyone but an admin gets `admin_required`. |
| `struct monitors list` | List Struct's own monitors (alert rules on the telemetry your services send to Struct, **Alerts** in the web app): id, name, state (`disabled`, `silenced` or the current state), severity, source (the template, or `condition`) and threshold. These commands need observability on for the workspace, not Auto Monitors (`observability_not_enabled` otherwise). |
| `struct monitors get <id>` | Show a monitor's summary; `--json` prints its full configuration exactly as Struct returns it (the CLI masks nothing itself). |
| `struct monitors templates` | List the monitor templates with their category, default threshold and a one-sentence description; `--json` prints the full catalog with each template's parameter schema. Start a monitor's JSON from here. |
| `struct monitors preview --file <path>` | Backtest a monitor before saving it, for example "Would have fired 3 times in the last 1h" (12 to 60 live checks at the cadence). The file (`-` for stdin) is the API's monitor JSON: camelCase fields, with `sourceConfig` keeping `template_id` and `params`. Monitors saved in the web app are condition monitors (`"sourceType": "condition"`, with the condition document in `sourceConfig.condition`); their threshold, window and cadence come from that document, so `get` and `chart` can show no top-level threshold. A template monitor previews as the condition its preset expands it into; `raw_sql` fails request validation. A file that is not a JSON object fails with `invalid_json` and nothing is sent. Query failures exit 1 with `query_failed`; with `--json`, the response includes `query.error` and exits 0. |
| `struct monitors create --file <path>`, `struct monitors update <id> --file <path>` | Create a monitor from a JSON file, or change one; `update` changes only the fields in the file. Needs the configure permission. |
| `struct monitors delete <id>` | Delete a monitor; its open alerts are closed and their channels told. Asks first; pass `--yes` without a terminal. Needs the configure permission. |
| `struct monitors silence <id>`, `struct monitors unsilence <id>` | Mute a monitor for `--for <30m\|2h\|1d>` or `--until <ISO 8601 time with a zone>` (exactly one), such as `2026-11-01T09:00:00Z`, with an optional `--reason`; or end every active silence now. Dates that do not exist are refused. |
| `struct monitors firings <id>`, `struct monitors resolve <monitor-id> <firing-id>` | List the alerts a monitor raised, newest first (`--limit <1-200>`, default 50, and `--page <n>`); or close an open one now; channels get an all-clear only for an announced alert (`--reason <text>`). With no answer from Struct, find the firing in `struct monitors firings <monitor-id> --json`, continuing with `--page` while `hasMore` is true; `resolved` means it was closed. Check before trying again. |
| `struct monitors chart <id>` | Show the monitor's value over time with its threshold and firings. `--window 6h`, `--bucket 5m`. Exits 1 with `query_failed` when the monitor's query fails; with `--json`, prints the response including `queryError` and exits 0. |
| `struct notification-groups list` / `get <id>` | CLI 3.1.0 or newer. List notification groups (named sets of Slack channels and webhooks that monitors send to) with how many monitors use each, or show one. `--query <text>` matches name, description, Slack channel ID or webhook host, ignoring case. Reads mask webhook secrets, header values and URL paths. |
| `struct notification-groups create` | `--name <name>`, optional `--description <text>`, one or more `--channel <channel>` (Slack ID, `#name` or link), `--imessage <email>`, `--imessage-chat <chat-id>` (with optional `--investigate`), `--sms <E.164>`, and `--repeat <interval>` (at least `1m`, at least `15m` for iMessage, at most 3 reminders), or `--file <path>` with the group as JSON (needed for webhooks), not both. A group reaches at most 20 receivers. Needs the configure permission. |
| `struct notification-groups update <id>` | Change only what you pass: `--name`, `--description` (`""` clears it), `--add-channel` (repeatable; accepts ID, `#name` or link; `--repeat` applies to added channels), `--remove-channel` (repeatable; use the canonical channel ID from `get`), `--add-imessage` / `--remove-imessage`, `--sms` / `--no-sms`, or `--file <path>`. Webhooks are kept unless the file replaces them. Channel flag edits check for concurrent changes automatically. For a file based on an earlier read, include that read's `updatedAt` as `expectedUpdatedAt`; otherwise the file can overwrite changes made since. On `group_changed`, read the group again and reconcile before retrying. |
| `struct notification-groups test <id>` *(upcoming CLI release)* | Request a clearly marked `[Test]` notification for every configured destination in the group (Slack, webhook, iMessage and SMS) and report per-destination `ok` and error details. Claimed workspaces only; needs the configure permission. Until that CLI release ships, call `POST /api/notification-groups/{id}/test` or use a disposable monitor. |
| `struct notification-groups delete <id>` | Delete a group no monitor uses. Asks first; pass `--yes` without a terminal. Attach groups to a monitor with `notificationGroupIds` in `struct monitors update --file`; `[]` removes them all. |
| `struct telemetry query --document <json>` / `--file <path>` | Run a document in the [query language](https://docs.struct.ai/observability/query-language.md); use exactly one input (`-` reads stdin). An invalid document exits 1 with `query_invalid`. Requires CLI 5.0.0 or newer. |
| `struct telemetry describe <traces\|logs\|metrics>` | List the services, fields and metrics a query can name. `--search <words>`, `--service <name>`, `--field <name>`, `--lookback <1h\|24h\|7d>`, `--page <n>`, `--page-size <5-100>`. Requires CLI 5.0.0 or newer. |
| `struct telemetry guide [topic]` | Print the language guide, or one worked example such as `top_n`. Requires CLI 5.0.0 or newer. |
| `struct telemetry span <trace-id> <span-id>` | Read every stored column of a span returned by a telemetry query. `--since <when>` (default 24 hours, at most 30 days). |
| `struct telemetry log <id>` | Read every stored column of a log, by the `id` of a raw logs row. `--at <timestamp>` (the row's `timestamp`) reads only the 2 seconds around it, at any age; otherwise `--since <when>` (default 1 hour). Requires CLI 6.0.0 or newer. |

Inspect actual query results. `telemetry services` reports record timestamps, not receipt times. A preview with `query.error`, a chart with `queryError` or a result with no matching data is not proof of a working monitor.

## Observations (dynamic instrumentation)

Use [Observations](https://docs.struct.ai/observability/observations/overview.md) and the [SIL reference](https://docs.struct.ai/observability/observations/sil-reference.md) to add permanent baseline captures or short-lived, auto-expiring triage overlays (`target: {"kind": "overlay", "id": "..."}`, `completion: {"expiresAfterSeconds": ...}`) on running Python services, verify live delivery and stop captures. Requires a claimed workspace with observability enabled.

| Command | What it does |
| - | - |
| `struct observations guide [topic]` *(upcoming CLI release)* | Print the SIL authoring guide or a worked example (`event_on_return`, `failure_event`, `paired_events`, `span_with_duration`, `conditional_metric`, `async_after_await`). Until published, read [SIL reference](https://docs.struct.ai/observability/observations/sil-reference.md). |
| `struct observations validate --file <path>` | Validate exact SIL text on Struct's compiler without storing anything. Invalid SIL exits 1 with `sil_refused` and diagnostics. |
| `struct observations draft --file <path> [--document <sil>]` | Create an immutable baseline or overlay draft from a request JSON file and optional SIL document; nothing is published yet. |
| `struct observations diff <draft-id>` | Review one page of before/after changes and advisory findings for a draft (`--cursor`, `--limit`). |
| `struct observations publish <draft-id>` | Publish a reviewed draft once. Retry the same draft ID after an uncertain response; `publish` does not confirm SDK installation. |
| `struct observations scopes` | List Observation scope IDs by service and environment. |
| `struct observations status <scope-id>` | Read scope revisions (`headRevision`, `baselineRevision`, `readyRevision`), a publication's artifact status (`--revision <n>`), or list observations (`--observations`). Artifact `ready` does not confirm SDK installation. |
| `struct observations verify <scope-id>` *(upcoming CLI release)* | Verify live Observation delivery over `--since <when>` (default `1h`, optional `--observation <id>`): separates artifact readiness, active `struct.observations.health` errors and captured telemetry (`delivering`, `unhealthy`, `no_data_yet`, `artifact_pending`, `stopped`). Until published, query `struct.observations.health` and `struct.observation.id` via `struct telemetry query`. |
| `struct observations stop <observation-id> --scope <scope-id> --expected-revision <n>` | Create and publish a baseline stop for a noisy or obsolete Observation. |

## Ingest and API keys

For claimed workspaces, key management requires an admin with `struct login --admin`. The temporary login created by `struct init` can manage the allowed keys before claim while active and activated; it does not need a separate human login for that step.

| Command | What it does |
| - | - |
| `struct keys ingest list`, `struct keys deploy list` | For claimed workspaces, admins signed in with `struct login --admin`: list ingest keys (`pk-`, for the SDKs; see [Instrument with Struct](https://docs.struct.ai/observability/instrumentation.md)) or deployment keys (`sk-`). Metadata only, never the key. `--all` includes expired keys; `--limit <1-100>`, `--page <n>`. |
| `struct keys ingest create`, `struct keys deploy create` | Create a key and print it once (the only stdout line, or `token` with `--json`). `--name <name>` (required), `--description <text>`, `--expires-at <date or time with a zone>`. `struct keys ingest create` also takes `--grant <service:environment>` (repeatable): the key then reads configuration only for those; without it, for every service and environment, which can't change later. |
| `struct keys ingest revoke <id>`, `struct keys deploy revoke <id>` | Revoke a key; anything using it stops working. A login without the admin permission gets `admin_login_required` (exit 4); with that permission, a non-admin gets `admin_required`. |
| `struct keys api list`, `create`, `revoke <id>` | The same for every `sk-` key, each limited by the scopes it was created with. `create` also takes `--scope <scope>` (repeatable; `deployments:write`, `telemetry:write` or `observations:read`; default `deployments:write`) and `--grant <service:environment>` (repeatable; needed with `observations:read`). `list` also shows scopes and pairs. |
| `struct keys api grant <id> <service:environment>`, `struct keys api ungrant <id> <grant-id>` | Change which services and environments a key with `observations:read` can read. `struct keys ingest grant` and `ungrant` do the same for an ingest key created with `--grant`; one created without it takes none. Removing a pair or revoking a key stops future downloads only: running processes keep the observations they already installed, so stop those first. |

Capture a new key directly into the application's approved secret configuration. Never print it into a shared transcript; key lists return metadata and cannot recover the secret.

## Auto Monitors and deployments

Use a claimed workspace and the [Auto Monitors setup guide](https://docs.struct.ai/agent/jobs/instrument-and-monitor.md). These commands select settings, providers and routing; an actual PR and deploy are separate verification steps.

| Command | What it does |
| - | - |
| `struct automonitors settings get` | Show whether Auto Monitors is on, how deploys are reported, the alert channels and the connected providers. |
| `struct automonitors settings set` | `--alert-channel <channel>` (id, `#name` or link; it also becomes the default channel) and `--environment <name>` (the production environment). |
| `struct automonitors channels list\|add\|remove` | Choose the Slack channels that receive Auto Monitors alerts. `add <channel>` joins Struct's bot to a public channel itself (invite it to private channels first); `--default` and `--description <text>` set the default channel and what belongs in it. Removing a channel outside the alert list changes nothing; a name or link Slack cannot resolve fails with `channel_not_found`. |
| `struct automonitors enable` | Turn Auto Monitors on. Safe to repeat; the result lists anything still missing, such as an alert channel. |
| `struct automonitors disable --yes` | Turn Auto Monitors off. `--yes` is required without a terminal or with `--json`. |
| `struct deploys setup github\|workflow\|webhook` | Choose how deploys reach Struct: GitHub deployment events, successful runs of a GitHub Actions workflow (`--workflow <path>`, defaults to the saved workflow or Struct's recommendation; Struct creates the repository webhook when the GitHub App may), or the [deployments API](https://docs.struct.ai/reference/deployments-api.md). `--environment <name>` for each. |
| `struct deploys show` | Show the deploy signal and whether Struct is ready to receive it. Never prints the webhook URL or secret: org admins see those in the Struct web app. |
| `struct deploys workflows list`, `struct deploys environments list [--query <text>] [--limit <n>]` | List the default repository's workflows (with Struct's recommendation and the saved workflow) and GitHub environment names. The environment limit defaults to 20 and accepts 1–50. |
| `struct triage get slack` | List the Slack triage channels with their Investigate (Ambient in Struct teammate channels) and Alerts state and keywords. |
| `struct triage slack add <channel>` | Add a channel (id, `#name` or Slack link) to triage. Struct's bot joins public channels itself; invite it to private channels first. New channels auto-investigate unless you pass `--no-investigate`. Safe to repeat. Needs the configure permission. |
| `struct triage slack set <channel>` | Change one channel: `--investigate on\|off`, `--include k1,k2`, `--exclude k1,k2` (`""` clears). Settings you leave out stay as they are. Needs the configure permission. |
| `struct triage slack remove <channel>` | Take a channel out of automatic triage: no alerts, no automatic investigations. Struct's bot stays in the channel, so an @Struct mention can still start an investigation. Safe to repeat. Needs the configure permission. |
| `struct github deploy-webhook show` | Workspace admins signed in with `struct login --admin`: the GitHub repository webhook that reports finished deploy workflow runs, with the payload URL and secret masked. Fails with `github_not_connected` without a GitHub connection. |
| `struct github deploy-webhook create` | Create or repair the webhook on the default repository. Prints the full payload URL and secret once, only when Struct makes new ones. |
| `struct github deploy-webhook rotate` | Replace the payload URL and secret (printed once); deliveries stop until GitHub has them. Asks first; pass `--yes` without a terminal. |

Additional commands: `struct automonitors settings set <provider>` edits provider-specific fields; `struct automonitors providers enable <provider>` and `disable <provider>` choose providers; `struct automonitors check <provider>` checks readiness. Inspect each command's `--help` and returned checks before enabling.

`struct deploys setup webhook` configures the deployment signal. Your CI still sends the real event through the [Deployments API](https://docs.struct.ai/reference/deployments-api.md); there is no `struct deploys send` command.

Slack channel selection/filtering is available through the commands above. Non-Slack triage team/project selection and advanced sensitivity or incident-channel policies currently use their documented app controls. CLI setup does not imply every UI setting has a command.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.