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

# OpenTelemetry

> Send sandbox and account metrics, and sandbox lifecycle events, to Datadog, Grafana Cloud, Honeycomb, or any OTLP collector. No traces, no agent or AI token data.

boat pushes your account's telemetry to one OTLP/HTTP endpoint that you choose. You do not install an agent in your sandboxes.

| Signal | Path | When |
| - | - | - |
| Sandbox and account metrics | `<endpoint>/v1/metrics` | Every 60 seconds |
| Sandbox lifecycle events, as OTLP log records | `<endpoint>/v1/logs` | When each event occurs |

boat does not send these:

| Not sent | Where to read it instead |
| - | - |
| Traces and spans | None. boat sends no traces. |
| Agent prompts, responses and tool calls | [Agent events](https://docs.boat.dev/integrated-agents/conversations.md#stream-events) |
| AI token usage | [`boat ai usage`](https://docs.boat.dev/ai-credentials#usage), for proxied sandboxes |
| The output of commands and processes | [Command history and logs](https://docs.boat.dev/long-running-tasks/command-history.md) |

To export telemetry from your own app in a sandbox, run your own OpenTelemetry SDK or collector in the sandbox.

| | CLI | API | SDKs |
| - | - | - | - |
| Set or replace | `boat telemetry set <endpoint> -H key=value` | `PUT /telemetry` | `setTelemetry` |
| Read status | `boat telemetry` | `GET /telemetry` | `getTelemetry` |
| Remove | `boat telemetry unset` | `DELETE /telemetry` | `deleteTelemetry` |

An account has one endpoint. The headers hold your vendor credentials. So the API needs a key with `account.admin`.

## Set the endpoint

Use the **Webhooks & OTel** tab in the dashboard. You can also use the CLI, the API or an SDK.

1. Give the base URL of the collector. boat adds `/v1/metrics` and `/v1/logs`.
2. Give the headers that your vendor needs. Read [Vendor settings](#vendor-settings).

If you paste a URL that ends in `/v1/metrics`, boat removes that part.

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat telemetry set https://otlp.datadoghq.com -H dd-api-key=$DD_API_KEY
# https://otlp.datadoghq.com
#   headers      dd-api-key
#   last export  -
# Saved. Test export accepted.
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X PUT "$BOAT_API_BASE/telemetry" \
  -H "Authorization: Bearer $BOAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"endpoint":"https://otlp.datadoghq.com","headers":{"dd-api-key":"'"$DD_API_KEY"'"}}'
# {"type":"telemetry.updated","telemetry":{"endpoint":"https://otlp.datadoghq.com","headers":["dd-api-key"],...},"test":{"ok":true,"status":202,"message":null}}
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
const saved = await sandbox.setTelemetry({
  endpoint: "https://otlp.datadoghq.com",
  headers: { "dd-api-key": process.env.DD_API_KEY! },
});
console.log(saved.test.ok, saved.test.status);
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
import os
from boat_sdk.models.telemetry_set_request import TelemetrySetRequest

saved = sandbox.set_telemetry(TelemetrySetRequest(
    endpoint="https://otlp.datadoghq.com",
    headers={"dd-api-key": os.environ["DD_API_KEY"]},
))
print(saved.test.ok, saved.test.status)
```

When you save, boat sends one empty metrics export immediately. boat returns the answer of the collector in `test`. So you see a wrong key or endpoint before you wait for data. The first metrics arrive within 60 seconds.

> [!NOTE]
>
> * The endpoint must use HTTPS on port 443 or 4318.
> * The endpoint must resolve only to public addresses.
> * boat encrypts the header values at rest and never returns them.
> * You can set up to 20 headers.

### Vendor settings

| Vendor | Endpoint | Headers |
| - | - | - |
| Datadog | `https://otlp.datadoghq.com` (use the OTLP host of your Datadog site) | `dd-api-key=<API key>` |
| Grafana Cloud | The OTLP endpoint on your stack's OpenTelemetry card, for example `https://otlp-gateway-prod-eu-west-2.grafana.net/otlp` | `Authorization=Basic <base64 of instanceId:token>` |
| Honeycomb | `https://api.honeycomb.io` (EU: `https://api.eu1.honeycomb.io`) | `x-honeycomb-team=<API key>`, `x-honeycomb-dataset=boat` |
| Your own OpenTelemetry Collector | `https://otel.example.com` (port 443 or 4318) | The auth header that your collector checks |

For Grafana Cloud, make the header value like this:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
echo -n "$GRAFANA_INSTANCE_ID:$GRAFANA_TOKEN" | base64
```

### Your own collector and Prometheus

1. Run the OpenTelemetry Collector with an OTLP/HTTP receiver behind TLS.
2. Export to Prometheus with remote write, or expose a scrape endpoint:

```yaml otelcol.yaml theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
receivers:
  otlp:
    protocols:
      http:
        endpoint: 0.0.0.0:4318
exporters:
  prometheus:
    endpoint: 0.0.0.0:8889
  debug: {}
service:
  pipelines:
    metrics: { receivers: [otlp], exporters: [prometheus] }
    logs: { receivers: [otlp], exporters: [debug] }
```

Prometheus turns `boat.sandbox.cpu.utilization` into `boat_sandbox_cpu_utilization`, with `boat_sandbox_id` and `boat_sandbox_name` labels.

## Metrics

* All metrics are gauges.
* Every point has `boat.sandbox.id` and `boat.sandbox.name`. So each sandbox is its own series in every vendor.
* A sandbox with [monitoring off](https://docs.boat.dev/data-retention/snapshots-and-monitoring-off.md#monitoring-off) sends no sandbox metrics. boat still sends its lifecycle events.

| Metric | Unit | Meaning |
| - | - | - |
| `boat.sandbox.cpu.utilization` | `1` | Share of CPU time busy, 0 to 1 |
| `boat.sandbox.memory.utilization` | `1` | Share of memory in use, 0 to 1 |
| `boat.sandbox.memory.usage` | `By` | Memory in use |
| `boat.sandbox.filesystem.utilization` | `1` | Share of the disk in use, 0 to 1 |
| `boat.sandbox.filesystem.usage` | `By` | Disk space in use |
| `boat.sandbox.io.pressure` | `1` | Share of time stalled on disk I/O, 0 to 1 |
| `boat.account.sandboxes.active` | `{sandbox}` | Sandboxes running now |
| `boat.account.sandboxes.limit` | `{sandbox}` | Sandboxes your plan lets run at once. Not sent on unlimited plans. |
| `boat.account.credit.balance` | `s` | Machine time left on the account. Not sent on unlimited plans. |

Each sandbox is one resource:

| Resource attribute | Value |
| - | - |
| `service.name` | `boat` |
| `service.instance.id`, `boat.sandbox.id` | The sandbox id |
| `boat.sandbox.name` | The sandbox name |
| `boat.sandbox.size` | The machine size |
| `boat.sandbox.memory.size`, `boat.sandbox.disk.size` | Total memory and disk, in bytes |
| `boat.account.id` | Your account id |

A sandbox sends points only while it runs. Each export holds the samples taken since the previous one.

## Events

Each [lifecycle event](https://docs.boat.dev/webhooks.md#events) is one OTLP log record. boat puts the event name in two places: the event name field of the record, and the `event.name` attribute.

| Event name | Severity |
| - | - |
| `sandbox.ready` | `INFO` |
| `sandbox.hydrated` | `INFO` |
| `sandbox.error` | `ERROR` |
| `sandbox.archived` | `INFO` |
| `sandbox.degraded` | `WARN` |
| `sandbox.recovered` | `INFO` |

Each record has these attributes:

| Attribute | Value |
| - | - |
| `boat.sandbox.id`, `boat.sandbox.name` | The sandbox |
| `boat.sandbox.state`, `boat.sandbox.previous_state` | The new and the old state, when the event has them |
| `boat.sandbox.reason` | Why, for `sandbox.degraded` and `sandbox.recovered` |
| `boat.event.id` | The same id as the webhook event. Use it to remove duplicates. |

## Delivery and errors

| Collector answer | What boat does |
| - | - |
| `2xx` | Done. A partial-success answer shows its message in `lastError`. |
| `429`, `502`, `503`, `504`, or no answer | Sends the same data again later. boat waits for `Retry-After` when the collector sends it. |
| Any other `4xx` or `5xx` | Drops that data and shows the error in `lastError`. Fix the key or the endpoint. boat sends the next window as usual. |

* boat sends metrics in time order.
* After an outage, boat sends at most the last 10 minutes of metrics.
* boat retries an event like a [webhook delivery](https://docs.boat.dev/webhooks.md#delivery-and-retries), up to 8 attempts.

To read the status, run:

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat telemetry
# https://otlp.datadoghq.com
#   headers      dd-api-key
#   last export  2026-10-09T12:00:10.000Z
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS "$BOAT_API_BASE/telemetry" \
  -H "Authorization: Bearer $BOAT_API_KEY"
# {"type":"telemetry.info","telemetry":{"endpoint":"...","headers":["dd-api-key"],"lastExportAt":"...","lastError":null,...}}
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
const { telemetry } = await sandbox.getTelemetry();
console.log(telemetry?.lastExportAt, telemetry?.lastError);
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
status = sandbox.get_telemetry()
print(status.telemetry.last_export_at if status.telemetry else None)
```

## Remove the endpoint

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat telemetry unset
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X DELETE "$BOAT_API_BASE/telemetry" \
  -H "Authorization: Bearer $BOAT_API_KEY"
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
await sandbox.deleteTelemetry();
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
sandbox.delete_telemetry()
```

boat stops the export. boat deletes the queued data immediately.

## Related

* [Webhooks](https://docs.boat.dev/webhooks.md): the same lifecycle events, signed, to your own HTTPS endpoint.
* [Command history and logs](https://docs.boat.dev/long-running-tasks/command-history.md): the output of the processes in a sandbox.


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