QueueStatsEvent
Emitted when queue statistics are requested via getQueueStats().
Defined in: src/core/events/types.ts:884
Emitted when queue statistics are requested via getQueueStats().
Remarks
This event provides a point-in-time snapshot of an AudioBufferQueue’s health metrics, including current size, total throughput counters, and the age of the oldest buffered chunk. One event is emitted per queue (input and output) each time getQueueStats() is called.
Use this event for dashboards, logging, or alerting on pipeline health.
Example
agent.on('queue.stats', (event) => {
console.log(
`Queue "${event.queueName}": ${event.size} buffered, ` +
`${event.totalEnqueued} in, ${event.totalDequeued} out, ` +
`oldest: ${event.oldestChunkAge}ms`
);
});
// Trigger stats emission
const stats = agent.getQueueStats();
See
- QueueOverflowEvent for overflow-specific alerts
- QueueEvent for all queue event types
Extends
BaseEvent
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
metadata? | Record<string, unknown> | Optional metadata associated with the event. Remarks May contain provider-specific data or debugging information. | BaseEvent.metadata | src/core/events/types.ts:88 |
oldestChunkAge | number | Age of the oldest chunk in the buffer, in milliseconds. Remarks Returns 0 when the buffer is empty or in draining mode. | - | src/core/events/types.ts:926 |
queueName | string | Diagnostic name of the queue. Remarks Typically 'input' or 'output'. | - | src/core/events/types.ts:894 |
size | number | Current number of chunks in the buffer. Remarks Always 0 when the queue is in draining (pass-through) mode. | - | src/core/events/types.ts:902 |
timestamp | number | Unix timestamp (in milliseconds) when the event occurred. Remarks Useful for latency measurements and debugging the pipeline timing. | BaseEvent.timestamp | src/core/events/types.ts:80 |
totalDequeued | number | Total number of chunks delivered to the drain callback. Remarks Includes both buffered chunks flushed during drain and pass-through chunks. | - | src/core/events/types.ts:918 |
totalEnqueued | number | Total number of chunks enqueued since creation. Remarks Includes chunks that were subsequently dropped due to overflow. | - | src/core/events/types.ts:910 |
type | "queue.stats" | Discriminant for this event type. | - | src/core/events/types.ts:886 |