TraceStax Docs
Event schema
This page provides a complete reference for all three TraceStax event types: task_event, heartbeat, and snapshot. For a conceptual overview of what each event type is used for, see Event model.
Events are delivered to the Ingest API individually — one event per request.
TaskEvent
Section titled “TaskEvent”A task_event is emitted for each notable state transition in a job’s lifecycle.
interface TaskEvent { type: "task_event"; framework: string; language: string; sdk_version: string; worker: WorkerInfo; task: TaskInfo; status: TaskStatus; metrics?: TaskMetrics; error?: TaskError; logs?: LogEntry[];}
interface WorkerInfo { key: string; hostname: string; pid: number | string; concurrency?: number; queues: string[]; // max 100}
interface TaskInfo { name: string; id: string; queue: string; attempt: number; parent_id?: string; chain_id?: string;}
type TaskStatus = | "started" | "succeeded" | "failed" | "retried" | "stalled" | "timeout";
interface TaskMetrics { duration_ms?: number; queued_ms?: number;}
interface TaskError { type: string; message: string; stack_trace?: string;}
interface LogEntry { level: "info" | "warn" | "error"; message: string; ts?: string; // ISO 8601}{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "TaskEvent", "type": "object", "required": ["type", "framework", "language", "sdk_version", "worker", "task", "status"], "properties": { "type": { "type": "string", "const": "task_event" }, "framework": { "type": "string", "description": "Job framework identifier, e.g. 'celery', 'bullmq', 'sidekiq', 'rq', 'oban'" }, "language": { "type": "string", "description": "Runtime language, e.g. 'python', 'node', 'ruby', 'elixir', 'go'" }, "sdk_version": { "type": "string", "description": "Semver string of the TraceStax SDK sending this event" }, "worker": { "type": "object", "required": ["key", "hostname", "pid", "queues"], "properties": { "key": { "type": "string" }, "hostname": { "type": "string" }, "pid": { "oneOf": [{ "type": "integer", "minimum": 1 }, { "type": "string", "minLength": 1 }] }, "concurrency": { "type": "integer", "minimum": 0 }, "queues": { "type": "array", "items": { "type": "string" }, "maxItems": 100 } } }, "task": { "type": "object", "required": ["name", "id", "queue", "attempt"], "properties": { "name": { "type": "string" }, "id": { "type": "string" }, "queue": { "type": "string" }, "attempt": { "type": "integer", "minimum": 0 }, "parent_id": { "type": "string" }, "chain_id": { "type": "string" } } }, "status": { "type": "string", "enum": ["started", "succeeded", "failed", "retried", "stalled", "timeout"] }, "metrics": { "type": "object", "properties": { "duration_ms": { "type": "number", "minimum": 0 }, "queued_ms": { "type": "number", "minimum": 0 } } }, "error": { "type": "object", "required": ["type", "message"], "properties": { "type": { "type": "string" }, "message": { "type": "string" }, "stack_trace": { "type": "string" } } }, "logs": { "type": "array", "maxItems": 10, "items": { "type": "object", "required": ["level", "message"], "properties": { "level": { "type": "string", "enum": ["info", "warn", "error"] }, "message": { "type": "string", "maxLength": 500 }, "ts": { "type": "string", "format": "date-time" } } } } }}{ "type": "task_event", "framework": "celery", "language": "python", "sdk_version": "0.4.1", "worker": { "key": "worker-prod-1:14523", "hostname": "worker-prod-1.internal", "pid": 14523, "concurrency": 8, "queues": ["default", "email"] }, "task": { "name": "app.tasks.email.send_welcome_email", "id": "3c8e4f12-7a1b-4d2e-9f3a-0b5c6d7e8f90", "queue": "email", "attempt": 2, "parent_id": null, "chain_id": "a1b2c3d4-onboarding-flow" }, "status": "retried", "metrics": { "duration_ms": 1842, "queued_ms": 312 }, "error": { "type": "SMTPConnectError", "message": "Connection refused to smtp.example.com:587", "stack_trace": "Traceback (most recent call last):\n File \"app/tasks/email.py\", line 34, in send_welcome_email\n client.connect()\nSMTPConnectError: Connection refused" }}Field reference
Section titled “Field reference”| Field | Type | Required | Description |
|---|---|---|---|
type | "task_event" | Yes | Must be the literal string task_event |
framework | string | Yes | Job framework name |
language | string | Yes | Runtime language |
sdk_version | string | Yes | TraceStax SDK version (semver) |
worker.key | string | Yes | Stable worker process identifier |
worker.hostname | string | Yes | Machine hostname |
worker.pid | integer or string | Yes | OS process ID. Accepts a positive integer or a non-empty string (some runtimes report PID as a string) |
worker.concurrency | integer | No | Max simultaneous jobs. Minimum 0 |
worker.queues | string[] | Yes | Queues this worker consumes (max 100 entries) |
task.name | string | Yes | Fully-qualified job name or class |
task.id | string | Yes | Unique job execution ID |
task.queue | string | Yes | Queue the job was dispatched to |
task.attempt | integer | Yes | Attempt number (0-indexed) |
task.parent_id | string | No | Parent job ID, if spawned by another job |
task.chain_id | string | No | Workflow chain identifier |
status | string | Yes | started succeeded failed retried stalled timeout |
metrics | object | No | Timing metrics for the task execution |
metrics.duration_ms | number | No | Execution time in milliseconds |
metrics.queued_ms | number | No | Time spent waiting in queue in milliseconds |
error.type | string | No* | Exception class name. Required when status is failed or retried |
error.message | string | No* | Exception message. Required when status is failed or retried |
error.stack_trace | string | No | Full stack trace as a string (max 16,384 characters) |
logs | array | No | Up to 10 structured log entries attached to the event |
logs[].level | string | Yes | info, warn, or error |
logs[].message | string | Yes | Log message (max 500 characters) |
logs[].ts | string | No | ISO 8601 timestamp of the log entry |
HeartbeatPayload
Section titled “HeartbeatPayload”A heartbeat is sent by a running worker to confirm it is alive.
interface HeartbeatPayload { framework: string; worker: WorkerInfo; // same as TaskEvent timestamp: string; // ISO 8601 language?: string; sdk_version?: string;}{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "HeartbeatPayload", "type": "object", "required": ["framework", "worker", "timestamp"], "properties": { "framework": { "type": "string" }, "worker": { "type": "object", "required": ["key", "hostname", "pid", "queues"], "properties": { "key": { "type": "string" }, "hostname": { "type": "string" }, "pid": { "oneOf": [{ "type": "integer", "minimum": 1 }, { "type": "string", "minLength": 1 }] }, "concurrency": { "type": "integer", "minimum": 0 }, "queues": { "type": "array", "items": { "type": "string" }, "maxItems": 100 } } }, "timestamp": { "type": "string", "format": "date-time" }, "language": { "type": "string" }, "sdk_version": { "type": "string" } }}{ "framework": "bullmq", "worker": { "key": "api-worker-7:9801", "hostname": "api-worker-7.internal", "pid": 9801, "concurrency": 4, "queues": ["notifications", "webhooks"] }, "timestamp": "2026-03-24T14:22:00.000Z", "language": "typescript", "sdk_version": "0.4.1"}Field reference
Section titled “Field reference”| Field | Type | Required | Description |
|---|---|---|---|
framework | string | Yes | Job framework name |
worker.key | string | Yes | Stable worker process identifier |
worker.hostname | string | Yes | Machine hostname |
worker.pid | integer or string | Yes | OS process ID |
worker.concurrency | integer | No | Max simultaneous jobs. Minimum 0 |
worker.queues | string[] | Yes | Queues this worker consumes (max 100 entries) |
timestamp | string | Yes | ISO 8601 datetime of when the heartbeat was generated |
language | string | No | Runtime language |
sdk_version | string | No | TraceStax SDK version |
SnapshotPayload
Section titled “SnapshotPayload”A snapshot reports queue statistics at a point in time.
interface SnapshotPayload { type: "snapshot"; framework: string; worker_key: string; queues: QueueSnapshot[]; timestamp: string; // ISO 8601}
interface QueueSnapshot { name: string; depth: number; active: number; failed: number; throughput_per_min: number;}{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "SnapshotPayload", "type": "object", "required": ["type", "framework", "worker_key", "queues", "timestamp"], "properties": { "type": { "type": "string", "const": "snapshot" }, "framework": { "type": "string" }, "worker_key": { "type": "string", "description": "The worker key of the worker that collected these statistics" }, "queues": { "type": "array", "minItems": 1, "items": { "type": "object", "required": ["name", "depth", "active", "failed", "throughput_per_min"], "properties": { "name": { "type": "string" }, "depth": { "type": "integer", "minimum": 0 }, "active": { "type": "integer", "minimum": 0 }, "failed": { "type": "integer", "minimum": 0 }, "throughput_per_min": { "type": "number", "minimum": 0 } } } }, "timestamp": { "type": "string", "format": "date-time" } }}{ "type": "snapshot", "framework": "sidekiq", "worker_key": "sidekiq-prod-3:22041", "queues": [ { "name": "default", "depth": 142, "active": 10, "failed": 3, "throughput_per_min": 47.2 }, { "name": "critical", "depth": 0, "active": 2, "failed": 0, "throughput_per_min": 8.1 } ], "timestamp": "2026-03-24T14:22:00.000Z"}Field reference
Section titled “Field reference”| Field | Type | Required | Description |
|---|---|---|---|
type | "snapshot" | Yes | Must be the literal string snapshot |
framework | string | Yes | Job framework name |
worker_key | string | Yes | The worker key of the process that collected these statistics |
queues | array | Yes | One entry per monitored queue (max 200 entries) |
queues[].name | string | Yes | Queue name |
queues[].depth | integer | Yes | Jobs waiting to be processed |
queues[].active | integer | Yes | Jobs currently being processed |
queues[].failed | integer | Yes | Jobs in the failed / dead-letter state |
queues[].throughput_per_min | number | Yes | Completed jobs per minute over the last measurement window |
timestamp | string | Yes | ISO 8601 datetime of when the snapshot was taken |
Size limits
Section titled “Size limits”| Limit | Value |
|---|---|
| Maximum request body size | 256 KB |
Maximum worker.queues entries | 100 |
Maximum logs entries per event | 10 |
Maximum snapshot queues entries | 200 |