REST API: TaskQueue Statistics
TaskRouter provides real time and historical statistics for TaskQueues.
TaskQueue Instance Statistics
Resource URI
GET /v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/Statistics
Parameter | Description |
---|---|
Minutes | Filter cumulative statistics by up to ‘x’ minutes in the past. This is helpful for statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. Defaults to 15 minutes. |
FriendlyName | Filter the TaskQueue stats based on a TaskQueue’s name (only for list resource) |
StartDate | Filter cumulative statistics by a start date. This is helpful for defining a range of statistics to capture. Input is a GMT ISO 8601 Timestamp. |
EndDate | Filter cumulative statistics by an end date. This is helpful for defining a range of statistics to capture. Input is a GMT ISO 8601 Timestamp. |
TaskChannel | Filter real-time and cumulative statistics by TaskChannel. Takes in a Unique Name ("voice", "sms", "default", etc.) or a TaskChannelSid. |
SplitByWaitTime | A comma separated values for viewing splits of tasks canceled and accepted above the given threshold in seconds. Ex: "5,30" would show splits of tasks that were canceled or accepted before or after 5 seconds and respectively, 30 seconds. This is great for showing short abandoned tasks or tasks that failed to meet your SLA. |
Note: Minutes cannot be used in combination with StartDate and EndDate parameters. If no parameters are passed, 15 minutes will be the default.
Real Time
Real time statistics relating to a TaskQueue include the following:
Field | Description |
---|---|
LongestTaskWaitingSid | The ID of the longest waiting Task |
LongestTaskWaitingAge | The age of the longest waiting Task |
TotalTasks | The total number of Tasks |
TasksByStatus | The Tasks broken down by status (for example: pending: 1, reserved = 3, assigned = 2, completed = 5) |
TasksByPriority | The Tasks broken down by priority (for example: 0: 10, 99:5) |
ActivityStatistics | The current Worker status count breakdown by Activity |
TotalEligibleWorkers | The total number of Workers eligible for Tasks in this TaskQueue, irrespective of Activity state. |
TotalAvailableWorkers | The total number of Workers available for Tasks in this TaskQueue |
Cumulative
Cumulative statistics relating to a TaskQueue include the following over the interval:
Field | Description |
---|---|
TasksEntered | The total number of Tasks entered into this TaskQueue |
TasksCanceled | The total number of Tasks canceled while in this TaskQueue |
TasksCompleted | The total number of Tasks completed while in this TaskQueue |
TasksDeleted | The total number of Tasks that were deleted while in this TaskQueue |
TasksMoved | The total number of Tasks moved to another TaskQueue from this TaskQueue |
AvgTaskAcceptanceTime | The average time (in seconds) from Task creation to reservation acceptance while in this TaskQueue |
ReservationsCreated | The total number of Reservations that were created for Tasks while in this TaskQueue |
ReservationsAccepted | The total number of Reservations that were accepted for Tasks while in this TaskQueue |
ReservationsRejected | The total number of Reservations that were rejected for Tasks while in this TaskQueue |
ReservationsTimedOut | The total number of Reservations that were timed out for Tasks while in this TaskQueue |
ReservationsCanceled | The total number of Reservations that were canceled for Tasks while in this TaskQueue |
ReservationsRescinded | The total number of Reservations that were rescinded |
WaitDurationUntilCanceled | The wait duration stats (avg, min, max, total) for tasks that were canceled while in this TaskQueue |
WaitDurationUntilAccepted | The wait duration stats (avg, min, max, total) for tasks that were accepted while in this TaskQueue |
SplitByWaitTime | The splits of the tasks canceled and accepted based on the provided SplitByWaitTime parameter |
TaskQueue RealTime Statistics
If you are only concerned with the real time statistics of your TaskQueue, you can utilize the below endpoint.
Resource URI
GET /v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/RealTimeStatistics
Parameter | Description |
---|---|
TaskChannel | Filter real-time statistics by TaskChannel. Takes in a Unique Name ("voice", "sms", "default", etc.) or a TaskChannelSid. |
Real Time
Real time statistics relating to a TaskQueue include the following:
Field | Description |
---|---|
LongestTaskWaitingSid | The ID of the longest waiting Task |
LongestTaskWaitingAge | The age of the longest waiting Task |
TotalTasks | The total number of Tasks |
TasksByStatus | The Tasks broken down by status (for example: pending: 1, reserved = 3, assigned = 2, completed = 5) |
TasksByPriority | The Tasks broken down by priority (for example: 0: 10, 99:5) |
ActivityStatistics | The current Worker status count breakdown by Activity |
TotalEligibleWorkers | The total number of Workers eligible for Tasks in this TaskQueue, irrespective of Activity state. |
TotalAvailableWorkers | The total number of Workers available for Tasks in this TaskQueue |
TaskQueue Cumulative Statistics
If you are only concerned with the cumulative statistics over a certain time period, you can utilize the below endpoint.
Resource URI
GET /v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/CumulativeStatistics
Parameter | Description |
---|---|
Minutes | Filter cumulative statistics by up to ‘x’ minutes in the past. This is helpful for statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. Defaults to 15 minutes. |
FriendlyName | Filter the TaskQueue stats based on a TaskQueue’s name (only for list resource) |
StartDate | Filter cumulative statistics by a start date. This is helpful for defining a range of statistics to capture. Input is a GMT ISO 8601 Timestamp. |
EndDate | Filter cumulative statistics by an end date. This is helpful for defining a range of statistics to capture. Input is a GMT ISO 8601 Timestamp. |
TaskChannel | Filter cumulative statistics by TaskChannel. Takes in a Unique Name ("voice", "sms", "default", etc.) or a TaskChannelSid. |
SplitByWaitTime | A comma separated values for viewing splits of tasks canceled and accepted above the given threshold in seconds. Ex: "5,30" would show splits of tasks that were canceled or accepted before or after 5 seconds and respectively, 30 seconds. This is great for showing short abandoned tasks or tasks that failed to meet your SLA. |
Note: Minutes cannot be used in combination with StartDate and EndDate parameters. If no parameters are passed, 15 minutes will be the default.
Cumulative
Cumulative statistics relating to a TaskQueue include the following over the interval:
Field | Description |
---|---|
TasksEntered | The total number of Tasks entered into this TaskQueue |
TasksCanceled | The total number of Tasks canceled while in this TaskQueue |
TasksCompleted | The total number of Tasks completed while in this TaskQueue |
TasksDeleted | The total number of Tasks that were deleted while in this TaskQueue |
TasksMoved | The total number of Tasks moved to another TaskQueue from this TaskQueue |
AvgTaskAcceptanceTime | The average time (in seconds) from Task creation to reservation acceptance while in this TaskQueue |
ReservationsCreated | The total number of Reservations that were created for Tasks while in this TaskQueue |
ReservationsAccepted | The total number of Reservations that were accepted for Tasks while in this TaskQueue |
ReservationsRejected | The total number of Reservations that were rejected for Tasks while in this TaskQueue |
ReservationsTimedOut | The total number of Reservations that were timed out for Tasks while in this TaskQueue |
ReservationsCanceled | The total number of Reservations that were canceled for Tasks while in this TaskQueue |
ReservationsRescinded | The total number of Reservations that were rescinded |
WaitDurationUntilCanceled | The wait duration stats (avg, min, max, total) for tasks that were canceled while in this TaskQueue |
WaitDurationUntilAccepted | The wait duration stats (avg, min, max, total) for tasks that were accepted while in this TaskQueue |
SplitByWaitTime | The splits of the tasks canceled and accepted based on the provided SplitByWaitTime parameter while in this TaskQueue |
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.