> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.recursiv.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.recursiv.io/_mcp/server.

# Observability & Monitoring

## Health & Readiness

* `GET /health` — basic liveness.
* `GET /ready` — readiness with DB check.
* `GET /ops` — agent ops manifest + runbooks (requires token).

## Metrics

`GET /metrics` exposes Prometheus-compatible counters and histograms.

If `METRICS_TOKEN` is set, provide:

```text
Authorization: Bearer <METRICS_TOKEN>
```

## Ops Endpoint

If `OPS_TOKEN` is set, provide:

```text
Authorization: Bearer <OPS_TOKEN>
```

`POST /ops/alert` accepts a generic payload or an Alertmanager payload. For Alertmanager, send the default JSON body.
Generic payload supports `runbookTag` for auto-tagging ops tasks.

`GET /ops/features` returns current feature flags and the allowlist.
`POST /ops/features` toggles an allowed flag.

## Alerts & SLOs

Sample Prometheus alert rules live in:

* `deploy/alerts/prometheus.rules.yml`

SLO definitions live in:

* `docs/operations/slo.md`

## Prometheus Scrape Example

Add a scrape job similar to:

```yaml
scrape_configs:
  - job_name: recursiv-api
    metrics_path: /metrics
    scheme: https
    bearer_token: ${METRICS_TOKEN}
    static_configs:
      - targets:
          - api.recursiv.io
```

## Logs

API logs are structured JSON with request IDs.

Fields:

* `requestId`
* `method`
* `path`
* `status`
* `durationMs`

Use `X-Request-Id` / `X-Trace-Id` to correlate client-side issues.