# Arcane Oversight: Developers and AI agents

> How to send logs, traces and metrics to Arcane Oversight with OpenTelemetry, the Oversight Agent or the Datadog Agent, how to search them, and how to read and automate Oversight from the arcane CLI and the HTTP API.

Arcane Oversight keeps your apps' and servers' logs, traces and metrics, finds their errors, and alerts, pages and opens incidents when something goes wrong. Data comes in over OpenTelemetry (any SDK or Collector) or from the Datadog Agent and libraries you already run, so instrumentation you have keeps working. This guide is for whoever wires it up or reads it without the browser: a developer, a CI job, or an AI agent. Everything is on this page, and the same text is at [/oversight/llms.txt](https://arcanesuite.com/oversight/llms.txt) for agents to read.

This page for people: https://arcanesuite.com/oversight/docs

## Quick start

1. Get Arcane Oversight from the Arcane Store. An organization shares one workspace, a personal account has its own. Open [oversight.arcanesuite.com](https://oversight.arcanesuite.com).

2. Settings → API keys → New key. Copy it: it's shown once (only its hash is kept). Only the organization's admins make keys.

3. Send traces, logs and metrics from a service: set these on it, with an OpenTelemetry SDK installed.

   ```sh
   OTEL_EXPORTER_OTLP_ENDPOINT=https://oversight.arcanesuite.com
   OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
   OTEL_EXPORTER_OTLP_HEADERS=oversight-api-key=<your key>
   OTEL_SERVICE_NAME=checkout
   OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=production
   ```

4. Send the machine's CPU, memory, disks, network and log files: run the Oversight Agent on it.

   ```sh
   docker run -d --name oversight-agent --restart unless-stopped --user 0:0 \
     -e OVERSIGHT_API_KEY=<your key> -e OVERSIGHT_ENV=production \
     -e OTEL_RESOURCE_ATTRIBUTES=host.name=$(hostname) \
     -v /:/hostfs:ro -v /var/run/docker.sock:/var/run/docker.sock:ro \
     -p 4317:4317 -p 4318:4318 \
     otel/opentelemetry-collector-contrib:latest \
     --config="https://oversight.arcanesuite.com/agent/config.yaml?container=1&docker=1&logs=/var/log/*.log"
   ```

5. Data shows up in Logs, APM, Metrics and Infrastructure within a minute. Then add monitors (Monitors → New monitor) so you hear about problems.

> Apps on **Arcane Compute** need none of this: their containers' output, CPU and memory, their servers and their databases already go to the organization's Oversight workspace, and the `OTEL_*` variables Compute gives send an app's traces once it has an OpenTelemetry SDK.

## How it's organized

| Thing | What it is |
|---|---|
| Workspace | Everything an organization (or a personal account) sends: one per organization, and every member sees the same data. |
| API key | What every request that sends data carries. Keys belong to the workspace; revoking one stops it within a minute. |
| Log | Time, `service`, `host`, `status`, `source`, `env`, `message`, tags (`key:value`) and attributes (anything else, nested). |
| Span | One operation of a trace: trace, span and parent ids, `service`, `name` (the operation), `resource` (what it did: `GET /orders/:id`, the SQL), kind, start, duration, error and attributes. A span where a request entered a service is its **entry**: APM's numbers count those. |
| Metric point | A metric name, tags, a time, a value and a type: `gauge`, `count`, `rate` or `cumulative`. |
| Service and environment | What every log, span and metric is grouped by: OpenTelemetry's `service.name` and `deployment.environment.name`, or Datadog's `service` and `env`. |
| Error issue | Errors grouped by service, type, message (numbers and ids taken out) and the top frame of the stack, from spans and logs. |

## Who may do what

Every member of the organization reads everything and makes monitors, SLOs, downtimes, dashboards, views, incidents and synthetic tests. API keys, notification channels (webhooks and email addresses) and log settings are the organization's admins' (a personal account is its own admin). A suspended organization can't sign in or read.

## API keys and limits

- Every request that sends data carries a key: the `Oversight-API-Key` header, or Datadog's `DD-API-KEY`, `x-api-key`, `Authorization: Bearer <key>`, or `?api_key=`. A missing or revoked key answers 403.
- Keys are 32 hexadecimal characters (as Datadog's, so the Datadog Agent's own checks accept them). `GET /api/v1/validate` with the key answers `{ "valid": true }`.
- Bodies may be sent as they are, or with `Content-Encoding: gzip` or `deflate`. **zstd isn't read** (415).
- A request is at most 20 MB after decompression (413). A workspace may send 100 GB a day; past it, intake answers 429 until 00:00 UTC.
- Errors answer `{ "errors": ["…"] }` with a status, as the Datadog Agent expects.

> An API key only sends data. It can't read anything: reading goes through a person's session or the arcane CLI's token (see [HTTP API](#api)).

## OpenTelemetry from your code

Any OpenTelemetry SDK (Node, Python, Go, Java, .NET, Ruby, PHP…) sends traces, logs and metrics with the standard variables. The SDK adds `/v1/traces`, `/v1/logs` and `/v1/metrics` to the endpoint. OTLP over HTTP takes protobuf or JSON; gRPC goes through the [Oversight Agent](#agent) on port 4317.

The service's environment:

```sh
OTEL_EXPORTER_OTLP_ENDPOINT=https://oversight.arcanesuite.com
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_HEADERS=oversight-api-key=<your key>
OTEL_SERVICE_NAME=checkout
OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=production,service.version=1.4.2
```

With the Oversight Agent on the same machine, point the SDK at it instead (`OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318`, no key): the Agent adds the key and the host's name.

| Oversight's field | From these OpenTelemetry attributes, in order |
|---|---|
| `service` | `service.name` (a log record's own `service` attribute wins for that log); Cloudflare Workers' `cloudflare.script_name`, then `faas.name`, when it's missing |
| `env` | `deployment.environment.name`, then `deployment.environment` |
| `host` | `host.name`, then `k8s.node.name`, then `host.id` |
| Log `status` | The record's severity number (1–4 `trace`, 5–8 `debug`, 9–12 `info`, 13–16 `warn`, 17–20 `error`, 21–24 `critical`), else its severity text |
| Span error | Status code `ERROR`; its type, message and stack from the `exception` event (`exception.type`, `exception.message`, `exception.stacktrace`) |
| HTTP status | `http.response.status_code`, then `http.status_code` |
| Database call | `db.system.name` / `db.system` (or Datadog's `db.type`), named by `db.namespace` and `server.address`; `db.query.text` with its values replaced by `?` becomes the span's resource |

Every other resource and record attribute is kept and searchable as `@attribute.path`. Put a log's trace and span ids on it (the SDKs' log bridges do) and its trace shows its logs.

## The Oversight Agent

One per machine. It's the open-source OpenTelemetry Collector (contrib distribution) with Oversight's configuration, which it reads from `https://oversight.arcanesuite.com/agent/config.yaml`. It sends the host's CPU, load, memory, disks, filesystems and network every 30 seconds, the log files you choose, Docker containers' CPU and memory, and whatever apps on the machine send it over OTLP on ports 4317 (gRPC) and 4318 (HTTP).

| Config option | Does |
|---|---|
| `container=1` | It runs in Docker with the host's filesystem mounted at `/hostfs`. |
| `docker=1` | Docker containers' numbers (mount `/var/run/docker.sock`). |
| `logs=/var/log/*.log,/srv/app/*.log` | Log files to follow, comma-separated globs (up to 20), from their end. |

It reads `OVERSIGHT_API_KEY` (required) and `OVERSIGHT_ENV` (the `env` of everything it sends) from its environment. The config holds no key, so it's public.

On Linux without Docker:

```sh
# 1. Install otelcol-contrib, the package for your system from
#    https://github.com/open-telemetry/opentelemetry-collector-releases/releases
# 2. Oversight's configuration and your key:
sudo curl -fsSL "https://oversight.arcanesuite.com/agent/config.yaml?docker=1&logs=/var/log/*.log" -o /etc/otelcol-contrib/config.yaml
echo 'OVERSIGHT_API_KEY=<your key>
OVERSIGHT_ENV=production' | sudo tee -a /etc/otelcol-contrib/otelcol-contrib.conf
sudo systemctl restart otelcol-contrib
```

The Docker command is in [Quick start](#quick-start). Settings → Send data builds both commands from the same choices.

## A Collector you already run

Add an `otlphttp` exporter and put it in your pipelines.

```yaml
exporters:
  otlphttp/oversight:
    endpoint: https://oversight.arcanesuite.com
    headers:
      oversight-api-key: ${env:OVERSIGHT_API_KEY}
    compression: gzip

service:
  pipelines:
    traces:  { receivers: [otlp], processors: [batch], exporters: [otlphttp/oversight] }
    metrics: { receivers: [otlp, hostmetrics], processors: [batch], exporters: [otlphttp/oversight] }
    logs:    { receivers: [otlp, filelog], processors: [batch], exporters: [otlphttp/oversight] }
```

## Moving from Datadog

Point the Datadog Agent you already run at Oversight and change nothing else: its metrics, host details, service checks, logs, and traces from Datadog's tracing libraries come in as they are. Payloads Oversight doesn't keep yet (processes, containers' live view) are accepted and dropped.

datadog.yaml's variables:

```sh
DD_API_KEY=<your Oversight key>
DD_DD_URL=https://oversight.arcanesuite.com
DD_SERIALIZER_COMPRESSOR_KIND=zlib
DD_LOGS_ENABLED=true
DD_LOGS_CONFIG_FORCE_USE_HTTP=true
DD_LOGS_CONFIG_LOGS_DD_URL=oversight.arcanesuite.com:443
DD_LOGS_CONFIG_COMPRESSION_KIND=gzip
DD_APM_ENABLED=true
DD_APM_DD_URL=https://oversight.arcanesuite.com
```

> `DD_SERIALIZER_COMPRESSOR_KIND=zlib` is required: the Agent's default, zstd, can't be read.

Integrations' metrics (`postgresql.*`, `mysql.*`, `redis.*`, `nginx.*`…) are ordinary metrics. Datadog's Database Monitoring samples, RUM, Security and CI Visibility aren't taken.

## Intake routes

For a sender of your own, a script, or a forwarder. All take the key as in [API keys](#keys).

- `POST /v1/logs · /v1/traces · /v1/metrics` — OTLP over HTTP, protobuf (`application/x-protobuf`) or JSON.
- `POST /api/v2/logs` — Logs in JSON: one object or an array.
  Body: `message` (or `msg`), `status` (or `level`, `severity`), `service`, `hostname`, `ddsource`, `ddtags` (`"env:prod,team:pay"`), `timestamp` (seconds, milliseconds or ISO); every other field is an attribute
- `POST /api/v1/series` — Metrics in JSON, as Datadog's v1.
  Body: `{ series: [{ metric, points: [[unix seconds, value]], type: "gauge" | "count" | "rate", interval?, host?, tags: ["env:prod"] }] }`
- `POST /api/v2/series` — Metrics in JSON or protobuf, as Datadog's v2.
  Body: `{ series: [{ metric, type: 0–3, points: [{ timestamp, value }], resources: [{ type: "host", name }], tags }] }`
- `POST /api/v1/check_run` — Service checks: each becomes a `service_check.<name>` point (0 OK, 1 warning, 2 critical, 3 unknown).
- `POST /intake/` — The Datadog Agent's host metadata: the host list's OS, CPU, memory and tags.
- `POST /api/v0.2/traces` — Datadog tracing libraries' spans, through the Agent.
- `GET /api/v1/validate` — Checks a key.

A log and a metric with curl:

```sh
curl -X POST https://oversight.arcanesuite.com/api/v2/logs \
  -H "Oversight-API-Key: $OVERSIGHT_API_KEY" -H "content-type: application/json" \
  -d '[{"message":"payment failed","service":"checkout","status":"error","ddtags":"env:production","order_id":"o_1842"}]'

curl -X POST https://oversight.arcanesuite.com/api/v1/series \
  -H "Oversight-API-Key: $OVERSIGHT_API_KEY" -H "content-type: application/json" \
  -d '{"series":[{"metric":"orders.placed","points":[['$(date +%s)', 1]],"type":"count","tags":["env:production"]}]}'
```

Log statuses are `emergency`, `alert`, `critical`, `error`, `warn`, `notice`, `info`, `debug`, `trace` and `ok`; other words are read as the nearest one (`fatal` → `emergency`, `warning` → `warn`), and none is `info`.

## Errors

Error Tracking groups errors into issues by service, type, message and the top frame of the stack that's yours (not a library's). An issue gets an occurrence from:

- A span with an error: where it was raised (with a stack or a type), or where the request entered the service. Its type, message and stack come from OpenTelemetry's `exception` event or Datadog's `error.type`, `error.message`, `error.stack`.
- A log with status `error` or above that has an error's kind or stack: `error.kind` / `error.type` / `exception.type`, or `error.stack` / `exception.stacktrace`. A log line without them stays a log.

An issue is open, resolved or ignored. A resolved issue that comes back reopens (a regression), and an `errors` monitor can alert on new and regressed issues.

An issue also has a fix, for agents that fix bugs: before working on one, an agent claims it, and only one claim can hold an issue at a time. The fix goes `fixing` → `pr_open` → `awaiting_deploy`, then a person resolves the issue; or `fix_failed`. A `fixing` claim expires after an hour without news, and can then be claimed again. An issue being fixed keeps counting its events, but an `errors` monitor doesn't alert on it, and a regression clears its fix. Claim and update it with the [API](#api) or the MCP tools below.

| MCP tool | Scope | Does |
|---|---|---|
| `list_errors` | oversight.read | Error issues, by status, service, environment, range and fix state. |
| `get_error` | oversight.read | One issue with a sample stack and its sample trace's id. |
| `get_trace` | oversight.read | A trace as a markdown report: spans, timings, errors, logs. |
| `list_slow_requests` | oversight.read | Endpoints whose p95 is over a threshold, or the slowest requests. |
| `claim_error_fix` | oversight.write | Claims an issue's fix, or says who already holds it. |
| `update_error_fix` | oversight.write | PR open, awaiting deploy, failed, released, or a heartbeat. |
| `open_pull_request` (Arcane Git) | git.pulls | Opens the fix's pull request with `oversightIssueId`: the issue then follows it on its own (PR open, awaiting deploy when merged, failed when closed). |

The MCP server is `https://mcp.arcanesuite.com/mcp` (OAuth in the browser; the person picks what it may reach). Its tools never resolve, ignore or delete an issue.

Arcane Flow can start a flow when Oversight sees something: an App event trigger on `oversight.error.new`, `oversight.error.regressed` (or `oversight.error` for both) or `oversight.monitor.alert` (a monitor going to Alert; slow requests through an APM latency monitor). The flow gets the issue's id, service, environment, type, message, counts, a sample trace and its link, or the monitor's name, tags, group, value and link. Triggers can be limited to services, environments, monitors or monitor tags. An issue someone is fixing sends no event, and a trigger starts at most 5 runs an hour (the rest show as skipped runs) and one run per issue in 30 minutes, both adjustable. To fix errors automatically, a flow claims the issue with `claim_error_fix` first and stops when someone else holds it.

## What's kept, and the price

| Data | Kept |
|---|---|
| Logs | Searchable for 15 days; archived for a year (Logs → Archive, a slower search over the archive). |
| Traces | Traces with an error or a span of 1 second or more are kept whole for 15 days, and 5% of the rest. APM's numbers (requests, errors, latency) count every span, kept or not. |
| Metrics | Per minute for 15 days, hourly for 15 months. |
| Synthetic test results | 30 days. |

On the Arcane invoice: $0.10 per GB sent (everything, archive included), $1.50 per million logs kept in the explorer, $5 per host sending metrics a month (by the day), $1 per 10,000 synthetic runs. Settings → Logs has exclusion filters: logs they match aren't kept in the explorer (so they aren't charged as kept), but still count in the archive, facets and errors. Settings → Usage shows each day's bytes, logs, spans and points.

## Searching logs and traces

Logs and Traces share one syntax, as Datadog's. Terms side by side are ANDed; `OR`, `NOT` or `-`, and parentheses combine them.

| Write | Matches |
|---|---|
| `timed out` · `"timed out"` | Words, or a phrase, in the message (logs) or in the resource, operation or error message (spans). `*` is a wildcard. |
| `service:web` · `env:prod` · `host:db-1` | A reserved field: logs' `service`, `host`, `status`, `source`, `env`, `trace_id`, `message`; spans' `service`, `resource_name`, `operation_name`, `env`, `host`, `kind`, `trace_id`, `span_id`, `error.type`, `error.message`. |
| `@http.route:/orders/*` · `@user.id:42` | An attribute, by its path. |
| `team:payments` | A tag (any other `key:value`). |
| `@http.status_code:>=500` · `@duration:[100ms TO 2s]` | Comparisons (`>`, `>=`, `<`, `<=`) and ranges. |
| `field:*` | The field exists. |
| `-host:db-1` · `NOT status:info` | Leaves out. |
| `(env:prod OR env:staging) status:error` | Groups. |

| Only on spans | Matches |
|---|---|
| `status:error` · `error:true` | Spans that failed. |
| `entry:true` | Where a request entered its service (one per request and service). |
| `@duration:>500ms` | By duration: `ns`, `us`, `ms`, `s`, `m`, `h`; a bare number is nanoseconds. |
| `@http.status_code:5xx` | A class of HTTP statuses. |

Example:

```
service:checkout env:production status:error -@http.route:/healthz "card declined"
```

## Metric queries

As Datadog writes them: `<space aggregation>:<metric>{<filters>} by {<tags>}`, then functions.

- Space aggregation: `avg` (the default), `sum`, `min`, `max`.
- Filters: `key:value`, `!key:value`, `key:val*`, comma-separated; `*` or none is everything.
- `by {host,env}` gives a series per value.
- `.as_count()`, `.as_rate()`, `.rollup(sum, 60)` (`avg`, `sum`, `min`, `max`, `count`, `last`, and seconds).

Examples:

```
avg:system.cpu.utilization{env:production,!host:db-1} by {host}
sum:orders.placed{env:production}.as_count().rollup(sum, 300)
```

The Oversight Agent's host metrics are OpenTelemetry's (`system.cpu.utilization`, `system.memory.utilization`, `system.filesystem.usage`…); the Datadog Agent's keep their names (`system.cpu.user`, `system.mem.used`…). `GET /api/metrics?search=` lists the names a workspace has.

## The arcane CLI

`npm install -g @arcana-labs/cli --registry https://npm.arcanesuite.com/` (Node 18 or newer), then `arcane login`: a person confirms the code in the browser once. It reads the signed-in person's workspace. The [Arcane CLI's guide](https://arcanesuite.com/cli#oversight) has every option.

| Command | Does |
|---|---|
| `arcane traces list [search] [--service s] [--env e] [--errors] [--min 500ms] [--range 1h \| --from t --to t] [--limit 25] [--spans]` | Requests newest first (spans with `--spans`), each with its trace id. `search` is the syntax above. |
| `arcane traces show <trace id> [--span id]` | The trace as a report for an agent: totals, time by service, errors with their stacks, repeated operations (N+1), the slowest spans, the tree and its logs. |
| `arcane traces services [--range 1h] [--env e]` | Each service's requests, errors and latency. |
| `arcane api oversight <METHOD> <path> [--data <json> \| --data @file]` | Any route of the HTTP API: logs, metrics, errors, monitors… |

Why did requests fail this afternoon?:

```sh
arcane traces list --service api --errors --range 4h
arcane traces show <trace id>
arcane api oversight GET "/api/logs?range=1h&q=service:api status:error&limit=50"
arcane api oversight GET "/api/metrics/query?range=4h&q=avg:system.cpu.utilization{*} by {host}"
```

`--json` on the `traces` commands prints the API's answer as it is.

## HTTP API

JSON over HTTPS at `https://oversight.arcanesuite.com`, with the token of a computer signed in with `arcane login` (`Authorization: Bearer …`, which `arcane api oversight` adds). These are the routes the app itself uses, for the signed-in person's workspace and under the same rules. Errors answer with a status and `{ "error": "…" }` in words.

| Parameter | Means |
|---|---|
| `range` | To now: `5m`, `15m`, `30m`, `1h`, `4h`, `12h`, `1d`, `2d`, `7d`, `15d`, `30d`… (each route has its default, mostly `15m` or `1h`). |
| `from`, `to` | Milliseconds since the epoch; they win over `range`. |
| `q` | A search ([syntax](#search)), or a metric query on `/api/metrics/query`. |
| `limit`, `sort`, `cursor` | Pages: up to 1000 (100 by default), `desc` (default) or `asc`; pass back the `cursor` an answer gave for the next page (`null` at the end). |

- `GET /api/logs` — Logs matching `q`: `{ items, cursor }`; each log has `key`, `ts`, `service`, `host`, `status`, `env`, `message`, `tags`, `attrs`, `traceId`.
- `GET /api/logs/:key` — One log by its `key`.
- `GET /api/logs/timeseries` — Log counts over time.
  Body: query: `q`, `groupBy` (a facet such as `service` or `@http.status_code`), `top`
- `GET /api/logs/facets` — The top values of facets among matching logs.
  Body: query: `q`, `fields=service,status,@http.route`
- `GET /api/logs/tail` — Logs after `cursor`, for following live (the app asks every 2 seconds).
- `GET /api/logs/archive` — The year-long archive, newest first (takes seconds); `before` (ms) pages back. Attributes aren't searchable there.
- `GET /api/spans` — Spans matching `q`: `{ items, cursor }`. Add `entry:true` to `q` for one per request.
- `GET /api/traces/:id` — A trace's spans and logs; `?format=md` for the report `arcane traces show` prints (`&span=` for one span); `?at=` (ms) says which day to look in first.
- `GET /api/traces/timeseries` — Span counts, or `measure=duration|errors`, over time.
  Body: query: `q`, `groupBy`, `top`
- `GET /api/apm/services` — Every service's requests, errors, error rate and latency (avg, p50, p95, p99).
  Body: query: `range`, `env`
- `GET /api/apm/services/:name` — One service over time and per endpoint.
- `GET /api/databases` — The databases services call, with calls, errors and latency.
- `GET /api/metrics/query` — Metric queries: `{ from, to, results: [{ query, interval, series: [{ tags, group, points: [[ms, value]] }] }] }`. Up to 10 `q`; one that fails answers its `error` alone.
  Body: query: `q` (repeat it), `range` (`1h` by default), `interval` (ms)
- `GET /api/metrics` — The metric names seen; `search=` narrows.
- `GET /api/metrics/:name` — A metric and the tags seen on it.
- `GET /api/hosts` — Every host with its latest CPU, load and memory; `/api/hosts/:name` for one.
- `GET /api/containers` — Containers reporting in the last 15 minutes, with CPU and memory.
- `GET /api/errors` — Error issues in the range, each with its `fix` (who is fixing it, or null) and `fixInProgress`.
  Body: query: `status` (`open` default, `resolved`, `ignored`, `all`), `service`, `env`, `search`, `fix` (`in_progress`, `none`, `fixing`, `pr_open`, `awaiting_deploy`, `fix_failed`), `range` (`1d`)
- `PATCH /api/errors/:id` — Resolves, ignores or reopens an issue, or assigns it.
  Body: `status?`, `assignee?` (a person's id, or null)
- `POST /api/errors/:id/claim-fix` — Claims the fix of an open issue before working on it, so it is never fixed twice at once. Atomic: the issue with `fix.state` `fixing`, or `409 { error: "already being fixed", code: "fix_in_progress", fix }` while someone holds it. A `fixing` claim expires after `ttlMinutes` (60) unless renewed; an expired or failed fix can be claimed again, as one more attempt.
  Body: `by` (who or what, as people read it), `runId?`, `note?`, `ttlMinutes?`, `maxAttempts?`
- `PATCH /api/errors/:id/fix` — Records the fix's progress: `pr_open` (needs `prUrl`), `awaiting_deploy`, `fix_failed`, `fixing`, or `released`; no `state` renews the claim. An update naming another run than the holder's gets 409. A resolved issue seen again clears the fix, keeping its attempts. A pull request in Arcane Git whose description says `Fixes oversight:<id>` (or links the issue) does this by itself: opened → `pr_open`, merged → `awaiting_deploy`, closed → `fix_failed`.
  Body: `state?`, `runId?`, `prUrl?`, `branch?`, `note?`, `ttlMinutes?`

### Monitors, SLOs and downtimes

- `GET /api/monitors` — Every monitor, with its state and when it last alerted.
- `POST /api/monitors` — A new monitor (body below).
- `GET · PATCH · DELETE /api/monitors/:id` — One monitor. PATCH takes the whole monitor, or only `{ paused }` or `{ mutedUntil }` (ISO, or null). Changing its query starts its states over.
- `GET /api/monitors/:id/events` — Its state changes, newest first.
- `GET · POST /api/slos` — SLOs with their status.
  Body: `name`, `kind` (`metric`: `goodQuery` and `totalQuery`; `monitor`: `monitorIds`), `target` and `warning?` (percent), `windowDays` (7, 30 or 90), `tags`
- `GET · POST /api/downtimes` — Silences monitors for a while.
  Body: `monitorIds` or `monitorTags`, `startsAt`, `endsAt` (ISO or null), `recurrence` (`daily`, `weekly` or null), `reason`
- `GET · POST /api/channels` — Notification channels (admins).
  Body: `{ kind: "webhook", name, url, secret? }` (a public https address) or `{ kind: "email", name, address }`
- `GET · POST /api/synthetics` — HTTP tests, run every 1, 5, 15, 30 or 60 minutes from Oversight.
  Body: `name`, `request: { method, url, headers: [{ name, value }], body, timeoutMs, followRedirects }`, `assertions` (`status` is/is_not, `time` lt ms, `header` contains/is/exists, `body` contains/not_contains/matches), `frequencyMinutes`, `tags`

| Monitor `type` | `query.query` is | It measures |
|---|---|---|
| `metric` | A [metric query](#metric-queries) (or a metric name with `filter`, `aggregation`, `groupBy`) | The query over the window, per group. |
| `logs` | A log search | How many logs matched in the window (per `groupBy`, a facet). |
| `apm` | A service's name; `filter` may hold `env:…` | `measure`: `error_rate` (percent), `latency` (ms; `aggregation` `avg`, `p50`, `p95`, `p99` or `max`) or `hits`. |
| `errors` | A service, or empty for all | New or regressed issues in the window. |
| `host` | `*` or tags (`env:prod`, `host:db-1`, `!role:test`) | Minutes since each matching host was last heard from. |
| `synthetic` | A test's id | Failed runs in the window. |

POST /api/monitors:

```json
{
  "name": "Checkout errors",
  "type": "apm",
  "query": { "query": "checkout", "filter": "env:production", "measure": "error_rate" },
  "options": { "comparator": ">", "critical": 5, "warning": 2, "windowMinutes": 5, "noDataMinutes": 0, "renotifyMinutes": 60 },
  "message": "{{monitor}} is {{state}}: {{value}}% of requests fail.",
  "tags": ["team:payments"],
  "priority": 2,
  "targets": { "users": [], "escalationIds": [], "channelIds": ["<channel id>"] },
  "incidentSeverity": "SEV-2"
}
```

Monitors run every minute. `options.critical` and `warning` are compared with `comparator`; `noDataMinutes` (0: off) says when a silent monitor goes to No data; `renotifyMinutes` (0: off) repeats an alert. `message` takes `{{value}}`, `{{group}}`, `{{state}}` and `{{monitor}}`. On Alert, `escalationIds` page whoever is on call and `incidentSeverity` declares an incident.

### Webhooks

A webhook channel gets a JSON POST each time a monitor changes state (and on each renotification). With a secret, it carries `X-Oversight-Signature: sha256=<HMAC-SHA256 of the body with the secret, hex>`: compute it over the raw body and compare before trusting it. An answer of 400 or above counts as a failure; it isn't retried.

```json
{
  "event": "monitor.state_changed",
  "monitor": { "id": "…", "name": "Checkout errors", "type": "apm", "tags": ["team:payments"], "priority": 2 },
  "state": "ALERT",
  "previous": "OK",
  "group": "",
  "value": 7.4,
  "renotify": false,
  "title": "[Triggered] Checkout errors",
  "message": "Checkout errors is ALERT: 7.4% of requests fail.",
  "url": "https://oversight.arcanesuite.com/monitors/…",
  "at": "2026-11-16T14:03:00.000Z"
}
```

States are `OK`, `WARN`, `ALERT` and `NO_DATA`. `group` is the group that changed (`host:db-1`), empty for a monitor without groups.

### Incidents and on-call

- `GET · POST /api/incidents` — Incidents (`status=active|resolved|all`); POST declares one.
- `GET · PATCH /api/incidents/:id` — One incident; status, severity and commander changes go on its timeline.
- `GET · POST /api/oncall/pages` — Pages (`status=triggered|acknowledged|resolved|all`); POST pages someone through an escalation policy, or one person.
- `GET /api/oncall/schedules · /api/oncall/escalations` — On-call schedules and escalation policies.

## A Node service, traced and logged

1. Install the SDK and its automatic instrumentation

   ```sh
   npm install @opentelemetry/api @opentelemetry/auto-instrumentations-node
   ```

2. Start the service with it and the variables

   ```sh
   export OTEL_EXPORTER_OTLP_ENDPOINT=https://oversight.arcanesuite.com
   export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
   export OTEL_EXPORTER_OTLP_HEADERS=oversight-api-key=$OVERSIGHT_API_KEY
   export OTEL_SERVICE_NAME=api
   export OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=production
   export OTEL_LOGS_EXPORTER=otlp
   node --require @opentelemetry/auto-instrumentations-node/register server.js
   ```

3. Check that requests arrive

   ```sh
   arcane traces services --range 15m
   arcane traces list --service api
   ```

## A Python service

1. Install the distro and the instrumentations for what's installed

   ```sh
   pip install opentelemetry-distro opentelemetry-exporter-otlp
   opentelemetry-bootstrap -a install
   ```

2. Run it under `opentelemetry-instrument` with the same variables

   ```sh
   OTEL_EXPORTER_OTLP_ENDPOINT=https://oversight.arcanesuite.com \
   OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
   OTEL_EXPORTER_OTLP_HEADERS=oversight-api-key=$OVERSIGHT_API_KEY \
   OTEL_SERVICE_NAME=worker \
   OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true \
   opentelemetry-instrument python app.py
   ```

## Alert a Slack-like endpoint on 5xx

1. Make a webhook channel (an admin of the organization)

   ```sh
   arcane api oversight POST /api/channels --data '{"kind":"webhook","name":"Ops hook","url":"https://hooks.example.com/oversight","secret":"<a long random string>"}'
   ```

2. Make a logs monitor with the channel's id

   ```sh
   arcane api oversight POST /api/monitors --data '{"name":"5xx on api","type":"logs","query":{"query":"service:api @http.status_code:>=500"},"options":{"comparator":">","critical":20,"windowMinutes":5,"noDataMinutes":0,"renotifyMinutes":0},"targets":{"users":[],"escalationIds":[],"channelIds":["<channel id>"]}}'
   ```

## Rules for agents

- To read, start with `arcane whoami`. If the computer isn't signed in, run `arcane login --no-browser`, give the person the link and the code it prints, and wait. Never ask for a password or a token in the conversation.
- To send data, the service needs an API key that a person made in Settings → API keys. Ask them to put it in the service's secrets (`OVERSIGHT_API_KEY`); never write it into code, a commit, a config file in the repository or the conversation.
- Instrument with OpenTelemetry and the standard `OTEL_*` variables. Always set `OTEL_SERVICE_NAME` and `deployment.environment.name`, so data is grouped by service and environment.
- On Arcane Compute, don't add an exporter or a key: Compute gives the `OTEL_*` variables and already collects the containers' output.
- To investigate a failure: `arcane traces list --errors --service <s>`, then `arcane traces show <trace id>`, then the logs of that trace (`arcane api oversight GET "/api/logs?q=trace_id:<id>&range=1d"`). Read the stack and the spans before changing code.
- Quote searches that have spaces, and give the time range you mean (`range`, or `from`/`to` in ms): the default is the last 15 minutes for logs and spans.
- Don't make, change, pause or delete monitors, channels, downtimes or incidents, or page anyone, unless the person asked for it.
- Show an error's text to the person as it is. It says what went wrong.
