Event Schema

Exact JSON structure produced by TraceKit for error, span, and message events.

Every event emitted to FileSink (JSONL) or HttpSink (POST /ingest) follows a common base envelope, plus type-specific fields. Optional fields (release, user, tags, breadcrumbs) are omitted when empty rather than set to null.

Error event (type: "error")

error_event.json
{  "event_id": "08f05a7464ba4717ae42184e255268f1",  "type": "error",  "timestamp": "2026-11-28T09:56:10.371Z",  "level": "error",  "environment": "production",  "sdk": {    "name": "tracekit",    "version": "0.1.0"  },  "runtime": {    "python": "3.14.7",    "platform": "Darwin"  },  "release": "0.1.0",  "exception": {    "type": "ZeroDivisionError",    "message": "division by zero",    "frames": [      {        "file": "app.py",        "function": "divide_bill",        "line": 15,        "code": "return total / people"      }    ]  },  "user": {    "id": "42",    "email": "alice@example.com"  },  "tags": {    "region": "us-east-1"  },  "breadcrumbs": [    {      "ts": "2026-11-28T09:56:10.371Z",      "message": "Loaded cart",      "category": "checkout"    }  ]}

Span event (type: "span")

level is "info" when status is "ok", and "error" when status is "error". duration_ms is rounded to 3 decimal places.

span_event.json
{  "event_id": "12c75fede0a8416da6d2f241e1f5426d",  "type": "span",  "timestamp": "2026-11-28T09:56:10.372Z",  "level": "error",  "environment": "production",  "sdk": {    "name": "tracekit",    "version": "0.1.0"  },  "runtime": {    "python": "3.14.7",    "platform": "Darwin"  },  "span": {    "name": "divide_bill",    "duration_ms": 0.487,    "status": "error"  }}

Message event (type: "message")

message_event.json
{  "event_id": "bf0fec97b99e48e1b439dbecc6b179fd",  "type": "message",  "timestamp": "2026-11-28T09:56:10.372Z",  "level": "warning",  "environment": "production",  "sdk": {    "name": "tracekit",    "version": "0.1.0"  },  "runtime": {    "python": "3.14.7",    "platform": "Darwin"  },  "message": "Checkout fallback used"}