Skip to content

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

Extends

  • BaseEvent

Properties

PropertyTypeDescriptionInherited fromDefined in
metadata?Record<string, unknown>Optional metadata associated with the event. Remarks May contain provider-specific data or debugging information.BaseEvent.metadatasrc/core/events/types.ts:88
oldestChunkAgenumberAge 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
queueNamestringDiagnostic name of the queue. Remarks Typically 'input' or 'output'.-src/core/events/types.ts:894
sizenumberCurrent number of chunks in the buffer. Remarks Always 0 when the queue is in draining (pass-through) mode.-src/core/events/types.ts:902
timestampnumberUnix timestamp (in milliseconds) when the event occurred. Remarks Useful for latency measurements and debugging the pipeline timing.BaseEvent.timestampsrc/core/events/types.ts:80
totalDequeuednumberTotal 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
totalEnqueuednumberTotal 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

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency