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.

Implements

Constructors

constructor

new TaskQueueStats(properties?): TaskQueueStats

Constructs a new TaskQueueStats.

Parameters

NameTypeDescription
properties?ITaskQueueStatsProperties to set

Returns

TaskQueueStats

Properties

approximateBacklogAge

Optional approximateBacklogAge: null | IDuration

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.

Implementation of

ITaskQueueStats.approximateBacklogAge


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.

Implementation of

ITaskQueueStats.approximateBacklogCount


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.

Implementation of

ITaskQueueStats.tasksAddRate


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.

Implementation of

ITaskQueueStats.tasksDispatchRate

Methods

toJSON

toJSON(): Object

Converts this TaskQueueStats to JSON.

Returns

Object

JSON object


create

create(properties?): TaskQueueStats

Creates a new TaskQueueStats instance using the specified properties.

Parameters

NameTypeDescription
properties?ITaskQueueStatsProperties to set

Returns

TaskQueueStats

TaskQueueStats instance


decode

decode(reader, length?): TaskQueueStats

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

TaskQueueStats

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): TaskQueueStats

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

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns

TaskQueueStats

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
messageITaskQueueStatsTaskQueueStats 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
messageITaskQueueStatsTaskQueueStats 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


getTypeUrl

getTypeUrl(typeUrlPrefix?): string

Gets the default type url for TaskQueueStats

Parameters

NameTypeDescription
typeUrlPrefix?stringyour custom typeUrlPrefix(default "type.googleapis.com")

Returns

string

The default type url


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