Table of Contents

Class TaskQueueStats

Namespace
Temporalio.Api.TaskQueue.V1
Assembly
Temporalio.dll

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.

public sealed class TaskQueueStats : IMessage<TaskQueueStats>, IEquatable<TaskQueueStats>, IDeepCloneable<TaskQueueStats>, IBufferMessage, IMessage
Inheritance
TaskQueueStats
Implements
IMessage<TaskQueueStats>
IDeepCloneable<TaskQueueStats>
IBufferMessage
IMessage
Inherited Members

Constructors

TaskQueueStats()

public TaskQueueStats()

TaskQueueStats(TaskQueueStats)

public TaskQueueStats(TaskQueueStats other)

Parameters

other TaskQueueStats

Fields

ApproximateBacklogAgeFieldNumber

Field number for the "approximate_backlog_age" field.

public const int ApproximateBacklogAgeFieldNumber = 2

Field Value

int

ApproximateBacklogCountFieldNumber

Field number for the "approximate_backlog_count" field.

public const int ApproximateBacklogCountFieldNumber = 1

Field Value

int

TasksAddRateFieldNumber

Field number for the "tasks_add_rate" field.

public const int TasksAddRateFieldNumber = 3

Field Value

int

TasksDispatchRateFieldNumber

Field number for the "tasks_dispatch_rate" field.

public const int TasksDispatchRateFieldNumber = 4

Field Value

int

Properties

ApproximateBacklogAge

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.

public Duration ApproximateBacklogAge { get; set; }

Property Value

Duration

ApproximateBacklogCount

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.

public long ApproximateBacklogCount { get; set; }

Property Value

long

Descriptor

public static MessageDescriptor Descriptor { get; }

Property Value

MessageDescriptor

Parser

public static MessageParser<TaskQueueStats> Parser { get; }

Property Value

MessageParser<TaskQueueStats>

TasksAddRate

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.
public float TasksAddRate { get; set; }

Property Value

float

TasksDispatchRate

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.
public float TasksDispatchRate { get; set; }

Property Value

float

Methods

CalculateSize()

Calculates the size of this message in Protocol Buffer wire format, in bytes.

public int CalculateSize()

Returns

int

The number of bytes required to write this message to a coded output stream.

Clone()

Creates a deep clone of this object.

public TaskQueueStats Clone()

Returns

TaskQueueStats

A deep clone of this object.

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object other)

Parameters

other object

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Equals(TaskQueueStats)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(TaskQueueStats other)

Parameters

other TaskQueueStats

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

MergeFrom(CodedInputStream)

Merges the data from the specified coded input stream with the current message.

public void MergeFrom(CodedInputStream input)

Parameters

input CodedInputStream

Remarks

See the user guide for precise merge semantics.

MergeFrom(TaskQueueStats)

Merges the given message into this one.

public void MergeFrom(TaskQueueStats other)

Parameters

other TaskQueueStats

Remarks

See the user guide for precise merge semantics.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

WriteTo(CodedOutputStream)

Writes the data to the given coded output stream.

public void WriteTo(CodedOutputStream output)

Parameters

output CodedOutputStream

Coded output stream to write the data to. Must not be null.