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

# Worker Telemetry

> Turn on the worker's telemetry logs and read each field to spot memory pressure, a stalled worker, or a slow hook destination

After this page you can turn on the worker's telemetry log and read each of its fields, so you can tell from your logs whether a worker is healthy, running out of memory, or held up by a slow hook.

Some worker problems never raise an error. Memory grows until the container kills the process, a hook destination stalls and callbacks pile up, or a poller stops and the worker quietly takes no new work. The worker writes two telemetry records that make these visible: a `Worker sizing` record once at startup, and a `Worker` record at a fixed interval.

## Turn It On

The periodic record is off by default. Set the interval in milliseconds:

```bash .env theme={null}
OUTPUT_WORKER_TELEMETRY_INTERVAL_MS=60000
```

The worker now logs one `Worker` record a minute. `0` turns it off. The `Worker sizing` record is always logged at startup, whatever the interval.

Both records go through the worker's logger under the `Telemetry` namespace, so they reach the same log pipeline as the rest of the worker's output. The examples below show the production JSON format.

## The Periodic Record

```json theme={null}
{
  "environment": "production",
  "level": "info",
  "message": "Worker",
  "namespace": "Telemetry",
  "service": "output-worker",
  "timestamp": "2026-12-04T15:30:00.000+00:00",
  "status": {
    "runState": "RUNNING",
    "workflowPollerState": "POLLING",
    "activityPollerState": "POLLING",
    "hasOutstandingWorkflowPoll": true,
    "hasOutstandingActivityPoll": true,
    "numInFlightWorkflowActivations": 0,
    "numInFlightActivities": 8,
    "numInFlightNonLocalActivities": 8,
    "numInFlightLocalActivities": 0,
    "numCachedWorkflows": 37,
    "numHeartbeatingActivities": 3
  },
  "memory": {
    "availableMemory": 3113850880,
    "memoryLimit": 4294967296,
    "memoryUsage": {
      "rss": 1181116416,
      "heapTotal": 503316480,
      "heapUsed": 440401920,
      "external": 52428800,
      "arrayBuffers": 20971520
    },
    "nonMainHeap": 740714496,
    "heapSizeLimit": 1610612736
  },
  "pendingHooks": {
    "count": 9,
    "averageAgeMs": 13023,
    "oldestAgeMs": 31240,
    "perName": {
      "onLLMRequest": { "count": 8, "averageAgeMs": 14650, "oldestAgeMs": 31240 },
      "onHttpCost": { "count": 1, "averageAgeMs": 12, "oldestAgeMs": 12 }
    }
  }
}
```

The record has three blocks: `status` says what the worker is doing, `memory` says how much room it has left, and `pendingHooks` says whether your hook handlers keep up. This example shows a healthy worker with one problem: eight `onLLMRequest` callbacks have been waiting for up to 31 seconds.

### status

These fields come straight from Temporal's [`Worker.getStatus()`](https://typescript.temporal.io/api/classes/worker.Worker#getstatus).

| Field | Meaning | What to watch for |
| - | - | - |
| `runState` | The worker's lifecycle state: `INITIALIZED`, `RUNNING`, `DRAINING`, `DRAINED`, `STOPPING`, `STOPPED`, or `FAILED`. | Anything but `RUNNING` outside a deploy. `DRAINING` means a [shutdown](https://docs.output.ai/operations/worker-shutdown.md) is in progress. |
| `workflowPollerState` | The workflow task poller: `POLLING`, `SHUTDOWN`, or `FAILED`. | Anything but `POLLING` while `runState` is `RUNNING` means the worker takes no new workflow tasks. |
| `activityPollerState` | The activity task poller, with the same values. | Same as above, for steps. |
| `hasOutstandingWorkflowPoll` | Whether a workflow poll request is open against Temporal. | Usually `true` on an idle worker. A worker that is full stops polling, so `false` under load is normal. |
| `hasOutstandingActivityPoll` | Whether an activity poll request is open. | Same as above, for steps. |
| `numInFlightWorkflowActivations` | Workflow tasks being processed right now. | Usually `0` or close to it, since workflow code runs briefly. |
| `numInFlightActivities` | Activities running right now, local and non-local. Each step, evaluator, and internal activity counts. | A value stuck at `TEMPORAL_MAX_CONCURRENT_ACTIVITY_TASK_EXECUTIONS` means the worker is full. See [Worker Tuning](https://docs.output.ai/operations/worker-tuning.md). |
| `numInFlightNonLocalActivities` | The regular activities among them. | - |
| `numInFlightLocalActivities` | The local activities among them. | - |
| `numCachedWorkflows` | Workflow Executions in the sticky cache. | It grows with traffic up to `maxCachedWorkflows` from the [sizing record](#the-sizing-record), and its memory shows up in `nonMainHeap`. |
| `numHeartbeatingActivities` | Running activities that have sent a heartbeat. | - |

### memory

The memory fields mix two scopes. Some cover the whole process, others only the main thread's V8 isolate. The worker runs workflow code in separate threads, each with its own isolate, so the main isolate is never the whole picture.

| Field | Scope | Meaning |
| - | - | - |
| `availableMemory` | Process | Bytes the process can still allocate before it reaches the container limit. This is the number that drops toward `0` before an out-of-memory kill. |
| `memoryLimit` | Process | The container's memory limit, or the machine's total memory when there is no limit. |
| `memoryUsage` | Mixed | Node's raw [`process.memoryUsage()`](https://nodejs.org/api/process.html#processmemoryusage). `rss` is the whole process's resident memory. `heapTotal` and `heapUsed` cover only the main isolate. |
| `nonMainHeap` | Process | `rss - heapUsed`: resident memory outside the main isolate's live objects. That includes workflow thread heaps, Temporal's native core, buffers, and heap pages V8 has reserved but not filled. Treat it as an upper bound on the workflow threads' heap, not a measurement of it. |
| `heapSizeLimit` | Main isolate | The main isolate's V8 heap ceiling. It never changes, but every record includes it so each one reads on its own. |

In practice this means:

* **`availableMemory` falling over time** is the early warning for an out-of-memory kill.
* **`heapUsed` growing** points at the main thread, where your steps and hook handlers run.
* **`nonMainHeap` growing while `heapUsed` stays flat** points at the workflow threads, usually the sticky cache. Cached workflow memory is counted here, so it grows with `numCachedWorkflows`.

[Worker Tuning](https://docs.output.ai/operations/worker-tuning.md) covers what to change in each case.

### pendingHooks

Every hook handler you register runs in the background: the worker starts it and moves on without waiting. A callback is pending from the moment it starts until it finishes or fails. A handler that awaits a slow destination, such as an HTTP endpoint or a paused Redis, stays pending, and it keeps its payload in memory while it waits.

| Field | Meaning |
| - | - |
| `count` | Callbacks still running. |
| `averageAgeMs` | Average time they have been running, in milliseconds. |
| `oldestAgeMs` | How long the oldest one has been running, in milliseconds. |
| `perName` | The same three values for each hook, keyed by name, such as `onLLMRequest`. Handlers registered with `on( 'eventName' )` are keyed by their event name. Only hooks with a pending callback appear. |

When nothing is pending, `count` is `0` and both ages are `null`, because there is no callback to measure.

Healthy handlers finish in milliseconds, so `count` stays near `0` from one record to the next. Watch for:

* **`count` climbing across records**: callbacks start faster than they finish. Memory grows with them, so check `availableMemory` too.
* **A large `oldestAgeMs`**: at least one callback is stuck, typically a request with no timeout.
* **One name dominating `perName`**: that hook's destination is the slow one. In the example above, `onLLMRequest` holds eight callbacks up to 31 seconds old, while `onHttpCost` finishes almost immediately.

Pending callbacks also matter at shutdown: the worker waits for them for up to `OUTPUT_HOOK_FLUSH_TIMEOUT_MS`, then exits without them. See [Worker Shutdown](https://docs.output.ai/operations/worker-shutdown.md). To keep handlers fast, follow the guidance in [Hooks](https://docs.output.ai/packages/core.md#hooks).

## The Sizing Record

At startup, the worker logs how much memory it could commit and how big its workflow cache is:

```json theme={null}
{
  "environment": "production",
  "level": "info",
  "message": "Worker sizing",
  "namespace": "Telemetry",
  "service": "output-worker",
  "timestamp": "2026-12-04T15:00:00.000+00:00",
  "workflowThreadPoolSize": 1,
  "reuseV8Context": true,
  "isolateCount": 2,
  "heapSizeLimit": 1610612736,
  "projectedCommittedHeap": 3221225472,
  "memoryLimit": 4294967296,
  "maxCachedWorkflows": 900,
  "workflowTaskSlots": 40
}
```

Each value is the one the worker resolved, not the one you requested.

| Field | Meaning |
| - | - |
| `workflowThreadPoolSize` | Threads running workflow code. Set it with `TEMPORAL_WORKFLOW_THREAD_POOL_SIZE`. |
| `reuseV8Context` | Whether workflows on a thread share one V8 context. Temporal estimates roughly 600 cached workflows per GB with it and 250 without. |
| `isolateCount` | `1 + workflowThreadPoolSize`: one isolate for the main thread plus one per workflow thread. A heap cap from `NODE_OPTIONS` applies to each isolate, so this multiplies it. |
| `heapSizeLimit` | The main isolate's heap ceiling, as resolved from `NODE_OPTIONS`. |
| `projectedCommittedHeap` | `isolateCount * heapSizeLimit`: the heap the process could commit if every isolate filled up. |
| `memoryLimit` | The limit the projection is compared against: the container's limit, or the machine's total memory. |
| `maxCachedWorkflows` | Size of the sticky workflow cache. Derived from the heap limit unless you set `TEMPORAL_MAX_CACHED_WORKFLOWS`. |
| `workflowTaskSlots` | Workflow tasks that can run at once. Absent with a resource-based tuner, which sizes slots while the worker runs. |

The worker follows the record with a warning when the numbers don't fit:

```text theme={null}
Worker isolates may commit more heap than the host allows
```

`projectedCommittedHeap` is above `memoryLimit`, so the isolates together can grow past the container. Lower the heap cap in `NODE_OPTIONS` or the thread count.

```text theme={null}
Worker runs more workflow tasks than it can cache, forcing replays
```

`workflowTaskSlots` is above `maxCachedWorkflows`, so concurrent tasks evict each other's workflows from the cache and the worker replays their history to recover. Raise `TEMPORAL_MAX_CACHED_WORKFLOWS` or lower `TEMPORAL_MAX_CONCURRENT_WORKFLOW_TASK_EXECUTIONS`.

[Memory and Isolates](https://docs.output.ai/operations/worker-tuning.md#memory-and-isolates) explains both trade-offs in depth.

## Next Steps

> [card] [Worker Tuning](https://docs.output.ai/operations/worker-tuning.md)
>
> Concurrency, polling, and memory settings for the worker.

> [card] [Worker Shutdown](https://docs.output.ai/operations/worker-shutdown.md)
>
> How the worker drains on a deploy, including pending hook callbacks.


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