Skip to main content

Class: TaskQueueStats

taskqueue.v1.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: null | $Properties

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

create(properties?): TaskQueueStats & $Properties

Creates a new TaskQueueStats instance using the specified properties.

Parameters

NameTypeDescription
properties?$PropertiesProperties to set

Returns

TaskQueueStats & $Properties

TaskQueueStats instance

create(properties?): TaskQueueStats

Parameters

NameType
properties?$Properties

Returns

TaskQueueStats


decode

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

Decodes a TaskQueueStats message from the specified reader or buffer.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from
length?numberMessage 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

decodeDelimited(reader): TaskQueueStats & $Properties

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

Parameters

NameTypeDescription
readerUint8Array | ReaderReader 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

encode(message, writer?): Writer

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

Parameters

NameTypeDescription
message$PropertiesTaskQueueStats message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


encodeDelimited

encodeDelimited(message, writer?): Writer

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

Parameters

NameTypeDescription
message$PropertiesTaskQueueStats message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


fromObject

fromObject(object): TaskQueueStats

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

Parameters

NameTypeDescription
objectObjectPlain object

Returns

TaskQueueStats

TaskQueueStats


toObject

toObject(message, options?): Object

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

Parameters

NameTypeDescription
messageTaskQueueStatsTaskQueueStats
options?IConversionOptionsConversion options

Returns

Object

Plain object