Skip to main content

Class: TaskQueueStats

TaskQueueStats contains statistics about task queue backlog and activity.

For workflow task queue type, this result is partial because tasks sent to sticky queues are not included. Read comments above each metric to understand the impact of sticky queue exclusion on that metric accuracy.

Properties​

approximateBacklogAge?​

optional approximateBacklogAge?: $Properties | null

Approximate age of the oldest task in the backlog based on the creation time of the task at the head of the queue. Can be relied upon for scaling decisions.

Special note for workflow task queue type: this metric does not count sticky queue tasks. However, because those tasks only remain valid for a few seconds, they should not affect the result when backlog is older than few seconds.


approximateBacklogCount​

approximateBacklogCount: Long

The approximate number of tasks backlogged in this task queue. May count expired tasks but eventually converges to the right value. Can be relied upon for scaling decisions.

Special note for workflow task queue type: this metric does not count sticky queue tasks. However, because those tasks only remain valid for a few seconds, the inaccuracy becomes less significant as the backlog size grows.


rateLimitingActive​

rateLimitingActive: boolean

Whether rate limiting blocked any dispatches within the recent observation window (approximately 30 seconds). When true, adding more workers will not increase throughput — the bottleneck is the rate limit, not worker count. This field is useful for auto-scaling systems to avoid unnecessary scale-up.


tasksAddRate​

tasksAddRate: number

The approximate tasks per second added to the task queue, averaging the last 30 seconds. These includes tasks whether or not they were added to/dispatched from the backlog or they were dispatched immediately without going to the backlog (sync-matched).

The difference between tasks_add_rate and tasks_dispatch_rate is a reliable metric for the rate at which backlog grows/shrinks.

Note: the actual tasks delivered to the workers may significantly be higher than the numbers reported by tasks_add_rate, because:

  • Tasks can be sent to workers without going to the task queue. This is called Eager dispatch. Eager dispatch is enable for activities by default in the latest SDKs.
  • Tasks going to Sticky queue are not accounted for. Note that, typically, only the first workflow task of each workflow goes to a normal queue, and the rest workflow tasks go to the Sticky queue associated with a specific worker instance.

tasksDispatchRate​

tasksDispatchRate: number

The approximate tasks per second dispatched from the task queue, averaging the last 30 seconds. These includes tasks whether or not they were added to/dispatched from the backlog or they were dispatched immediately without going to the backlog (sync-matched).

The difference between tasks_add_rate and tasks_dispatch_rate is a reliable metric for the rate at which backlog grows/shrinks.

Note: the actual tasks delivered to the workers may significantly be higher than the numbers reported by tasks_dispatch_rate, because:

  • Tasks can be sent to workers without going to the task queue. This is called Eager dispatch. Eager dispatch is enable for activities by default in the latest SDKs.
  • Tasks going to Sticky queue are not accounted for. Note that, typically, only the first workflow task of each workflow goes to a normal queue, and the rest workflow tasks go to the Sticky queue associated with a specific worker instance.

Methods​

toJSON()​

toJSON(): object

Converts this TaskQueueStats to JSON.

Returns​

object

JSON object


create()​

Call Signature​

static create(properties?): TaskQueueStats & $Properties

Creates a new TaskQueueStats instance using the specified properties.

Parameters​
properties?​

$Properties

Properties to set

Returns​

TaskQueueStats & $Properties

TaskQueueStats instance

Call Signature​

static create(properties?): TaskQueueStats

Creates a new TaskQueueStats instance using the specified properties.

Parameters​
properties?​

$Properties

Properties to set

Returns​

TaskQueueStats

TaskQueueStats instance


decode()​

static decode(reader, length?): TaskQueueStats & $Properties

Decodes a TaskQueueStats message from the specified reader or buffer.

Parameters​

reader​

Uint8Array<ArrayBufferLike> | Reader

Reader or buffer to decode from

length?​

number

Message length if known beforehand

Returns​

TaskQueueStats & $Properties

TaskQueueStats

Throws​

If the payload is not a reader or valid buffer

Throws​

If required fields are missing


decodeDelimited()​

static decodeDelimited(reader): TaskQueueStats & $Properties

Decodes a TaskQueueStats message from the specified reader or buffer, length delimited.

Parameters​

reader​

Uint8Array<ArrayBufferLike> | Reader

Reader or buffer to decode from

Returns​

TaskQueueStats & $Properties

TaskQueueStats

Throws​

If the payload is not a reader or valid buffer

Throws​

If required fields are missing


encode()​

static encode(message, writer?): Writer

Encodes the specified TaskQueueStats message. Does not implicitly temporal.api.taskqueue.v1.TaskQueueStats.verify|verify messages.

Parameters​

message​

$Properties

TaskQueueStats message or plain object to encode

writer?​

Writer

Writer to encode to

Returns​

Writer

Writer


encodeDelimited()​

static encodeDelimited(message, writer?): Writer

Encodes the specified TaskQueueStats message, length delimited. Does not implicitly temporal.api.taskqueue.v1.TaskQueueStats.verify|verify messages.

Parameters​

message​

$Properties

TaskQueueStats message or plain object to encode

writer?​

Writer

Writer to encode to

Returns​

Writer

Writer


fromObject()​

static fromObject(object): TaskQueueStats

Creates a TaskQueueStats message from a plain object. Also converts values to their respective internal types.

Parameters​

object​

Plain object

Returns​

TaskQueueStats

TaskQueueStats


toObject()​

static toObject(message, options?): object

Creates a plain object from a TaskQueueStats message. Also converts values to other types if specified.

Parameters​

message​

TaskQueueStats

TaskQueueStats

options?​

IConversionOptions

Conversion options

Returns​

object

Plain object