> ## Documentation Index
> Fetch the complete documentation index at: https://weights.fyi/run/llms.txt

# Tracing and exports

Every step of every job is recorded as OpenTelemetry-shaped spans and events, and is yours: in the job's log, as downloads, and, if you like, sent as it happens to your own tools.

> **Status.** Traces have been live since 2026-10-08; content logging, the trace viewer and canonical Weights names are included in the implementation reviewed on 2026-10-10. Tracing and tracking is free today: its fee per job is $0.00.

## Which record answers what

Four records describe work on this service. They share identifiers, not a format.

| You ask | Read | What it holds |
|---|---|---|
| What did this job do, step by step? | Job traces: [GET /v1/jobs/{job_id}/logs](/run/docs/reference/jobs-logs.md), [GET /v1/traces](/run/docs/reference/traces.md), your own destinations | The spans and events of one `job_id`: each call to the model, each wait and each move. |
| Where is my queued plan, and what did it deliver? | ComputePlan events and the plan's receipt: [GET /v1/compute/events](/run/docs/reference/compute-events.md), [GET /v1/compute/plans/{plan_id}](/run/docs/reference/compute-plans-get.md) | The lifecycle of one `plan_id`, its stages and packs: admitted, waiting, leased, completed, failed; and the receipt's `outcome`, `coverage` and `accounting`. |
| What was I charged for one request? | Usage receipts: [GET /v1/usage](/run/docs/reference/usage.md) with `?schema=weights.receipts/v1` | One receipt per settled request, by `request_id`: the units billed and the amount. Without `schema`, your balance and totals. |
| What is the whole service doing right now? | Snapshot v1 | The operator's record, not a customer one: it takes an operator's token and has its own description, apart from this reference. |

## What is recorded

A job is one trace, rooted in a span named `job` that runs from its creation until no page is open. Under it:

- a span named `node.call` for each call to the model that carried its pages, with the pages, the time and the outcome (the names are the service's own and stay as they are);
- the events `job.queued`, `job.cold_start` (the model was not ready, with the expected wait), `job.waiting_for_credit`, `job.waiting_for_token_daily_cap` (a training job at its token's cap, merged 2026-10-09) and `job.cancelled`;
- `endpoint.interrupted` and `endpoint.resumed` around a move to new hardware;
- for a training job, a `node.train` span per run and the events `training.started`, `training.checkpoint`, `training.moving`, `training.resumed` and `training.done` or `training.failed`.

Your account has its own trace for credit (`billing.grant`, `billing.topup`), charges (`billing.charge`, `billing.option`), datasets (`dataset.ready`) and requests to make the model ready (`model.wake_requested`). Spans carry counts, times, identifiers and codes. Page text and dataset rows never appear. A page's result goes only where you ask for it: to a destination with "include outputs" on, and to the job log with `?outputs=1`.

Use `X-Weights-` headers, `Weights-Notice` and `weights.*` trace fields. OTLP identifies this service as `weights.fyi`, with scope `weights.telemetry`.

## The job log and downloads

[GET /v1/jobs/{job_id}/logs](/run/docs/reference/jobs-logs.md) lists one job's spans and events in order:

```sh
curl -s https://weights.fyi/run/v1/jobs/JOB_ID/logs -H "Authorization: Bearer $WEIGHTS_API_KEY"
```

Three downloads stream your records as files, without the Tracing and tracking option: a page job's results as NDJSON ([results.ndjson](/run/docs/reference/jobs-results-ndjson.md)), every credit and charge as CSV ([usage.csv](/run/docs/reference/usage-csv.md)), and your spans for a period as one OpenTelemetry JSON request, at most 512 spans an answer with `X-Weights-Next-After` for the rest ([GET /v1/traces](/run/docs/reference/traces.md)):

```sh
curl -s "https://weights.fyi/run/v1/traces?from=2026-10-08T00:00:00Z&to=2026-10-09T00:00:00Z" \
  -H "Authorization: Bearer $WEIGHTS_API_KEY" -D headers.txt -o traces.json
```

## Your own destinations

A destination receives your spans as they end. Add one on your panel ([/app](/run/app), Tracing) or with [POST /v1/trace-sinks](/run/docs/reference/trace-sinks-create.md). It sends only while the option Tracing and tracking is on, which you switch on your panel; while off, destinations are kept but paused, and one added then starts paused.

| Kind | What is sent |
|---|---|
| `otlp_http` (the default) | OpenTelemetry over HTTP, in the JSON encoding, posted to your address with `/v1/traces` added, with the headers you gave. |
| `mlflow` | The same, to an MLflow tracking server's trace intake at your address with `/v1/traces` added; the header `x-mlflow-experiment-id` is required. |
| `webhook` | JSON lines, posted to your address as given and signed (below): one span a line, and the compute events of every plan that names it in `notify`. |

The address is `https`, every address it resolves to must be public, checked again at each delivery, and redirects are not followed. Header values are secret: used, never shown back. A destination gets the spans that end after you add it. No span is dropped while your end is down: delivery is retried from 1 s up to 64 s apart, and the panel shows what waits and the last error. An account has at most 6 destinations. [Test one](/run/docs/reference/trace-sinks-test.md) before you rely on it. A confidential workspace cannot add a destination: the call answers `400 invalid_preferences`.

### Checking a webhook's signature

The signing secret, `fabwh_…`, is shown once. Each delivery carries `X-Weights-Timestamp` (Unix seconds) and `X-Weights-Signature: sha256=<hex>`, the HMAC-SHA256 of the timestamp, a dot and the raw body; the timestamp lets you refuse replays:

```python
import hashlib, hmac

def genuine(secret: str, timestamp: str, body: bytes, signature: str) -> bool:
    expected = hmac.new(secret.encode(), timestamp.encode() + b"." + body, hashlib.sha256).hexdigest()
    return hmac.compare_digest("sha256=" + expected, signature)

# The same check in the Python SDK: the delivery's lines, or WebhookRefused naming why not.
from weights.sdk import compute_events, verify_webhook
lines = verify_webhook(secret, headers, body, max_age_seconds=MAX_AGE_SECONDS)
```

### Compute events on a webhook

A ComputePlan naming a webhook in `notify` pushes its events there, signed alike, one line each:

```json
{"type": "compute_event", "schema": "weights.compute-event/v1", "event_id": "compute-event-4182", "seq": 4182, "emitted_at_ms": 1795161600000, "event": "pack_completed", "account_id": 12, "tenant_id": "tenant_12", "org_slug": "acme", "container_id": null, "plan_id": "waves-2026-11-20", "stage_id": "pages", "pack_id": "wave-0", "ordinal": 0, "data": {"output_uri": "r2://tenants/tenant_12/results/waves/plans/waves-2026-11-20/stages/pages/index-00000.jsonl.zst", "output_sha256": "9f2c41d07a5be3c8a6f1e0d2b4c7a9e8f3d6b1a0c5e4f7d2a9b8c3e6f1a0d4b7", "items_completed": 500}}
```

| Field | Holds |
|---|---|
| Subscribe | `"notify": {"sink_id": ID, "events": []}` on [POST /v1/compute/plans](/run/docs/reference/compute-plans-create.md), or `notify_sink_id` in the [SDK](/run/docs/sdk.md#standing-streams-and-push-events); `[]` is every public event. From a shell, `weights sinks create URL --pipe` adds the destination and pipes its id and secret to your receiver as one JSON line. |
| `type`, `schema` | `compute_event` and `weights.compute-event/v1`; a span line is `type: "span"`. |
| `event_id`, `seq` | One id per event. Delivery is at least once and oldest first, so key on `event_id`. |
| `event` | `plan_admitted`, `pack_completed`, `stage_completed`, `plan_completed` and the other public plan events of [GET /v1/compute/events](/run/docs/reference/compute-events.md); `notify.events` narrows them. |
| `plan_id`, `stage_id`, `pack_id`, `ordinal` | What the event is about; `pack_id` and `ordinal` on pack events only. |
| `data` | The event's public fields: a pack's `output_uri`, `output_sha256` and `items_completed`; a stage's or a plan's `outcome` and `coverage`. |

## Logging inputs and outputs

Two switches, off by default and independent, keep copies of what new jobs were given and what they answered, so you can debug a page that was classified oddly; turning one off also stops copies for running jobs, and training rows are never copied. Copies are kept seven days, at most 16 KiB an entry (larger ones as a marked preview) and 16 MiB an account. Deleting them removes every stored copy, not your results, datasets, or copies already sent to your tools. Use [PUT /v1/trace-preferences](/run/docs/reference/trace-preferences-put.md), [GET /v1/jobs/{job_id}/trace-content](/run/docs/reference/jobs-trace-content.md) and [DELETE /v1/trace-content](/run/docs/reference/trace-content-delete.md), or the panel, which includes a viewer for your own traces. A destination with "include outputs" on, and the job log with `?outputs=1`, get a bounded sample on the `job` span; [GET /v1/traces](/run/docs/reference/traces.md) stays content-free, and our own traces never receive it. A confidential workspace must keep both switches off: turning one on answers `400 invalid_preferences`. The switches govern content only; spans, usage and receipts are kept either way.

## Join your own trace

Send a W3C `traceparent` with [POST /v1/classify](/run/docs/reference/classify.md), [POST /v1/jobs](/run/docs/reference/jobs-create.md) or [POST /v1/endpoint/warm](/run/docs/reference/endpoint-warm.md), and the job lands under your span; the answer carries the job's own `traceparent`. An unusable one is ignored, with `Weights-Notice: traceparent_ignored`:

```sh
curl -s -i https://weights.fyi/run/v1/classify \
  -H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/json" \
  -H "traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01" \
  -d '{"model": "laya-page-role", "pages": ["First page text"]}'
```
