Skip to content

Commit 2c64a5d

Browse files
authored
TaskQueue per-priority stats (#611)
_**READ BEFORE MERGING:** All PRs require approval by both Server AND SDK teams before merging! This is why the number of required approvals is "2" and not "1"--two reviewers from the same team is NOT sufficient. If your PR is not approved by someone in BOTH teams, it may be summarily reverted._ <!-- Describe what has changed in this PR --> **What changed?** Adding a breakdown of stats per-priority levels to the two APIs that return task queue stats already. <!-- Tell your future self why have you made these changes --> **Why?** To give users insights on a per priority level. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** N/A <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> **Server PR** temporalio/temporal#8030
1 parent 76b8fcb commit 2c64a5d

File tree

3 files changed

+57
-11
lines changed

3 files changed

+57
-11
lines changed

openapi/openapiv2.json

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7224,6 +7224,13 @@
72247224
"stats": {
72257225
"$ref": "#/definitions/v1TaskQueueStats",
72267226
"description": "Only set if `report_task_queue_stats` is set on the request."
7227+
},
7228+
"statsByPriorityKey": {
7229+
"type": "object",
7230+
"additionalProperties": {
7231+
"$ref": "#/definitions/v1TaskQueueStats"
7232+
},
7233+
"description": "Task queue stats breakdown by priority key. Only contains actively used priority keys.\nOnly set if `report_task_queue_stats` is set to true in the request."
72277234
}
72287235
}
72297236
},
@@ -10804,14 +10811,21 @@
1080410811
"$ref": "#/definitions/v1PollerInfo"
1080510812
}
1080610813
},
10814+
"stats": {
10815+
"$ref": "#/definitions/v1TaskQueueStats",
10816+
"description": "Statistics for the task queue.\nOnly set if `report_stats` is set on the request."
10817+
},
10818+
"statsByPriorityKey": {
10819+
"type": "object",
10820+
"additionalProperties": {
10821+
"$ref": "#/definitions/v1TaskQueueStats"
10822+
},
10823+
"description": "Task queue stats breakdown by priority key. Only contains actively used priority keys.\nOnly set if `report_stats` is set on the request."
10824+
},
1080710825
"versioningInfo": {
1080810826
"$ref": "#/definitions/v1TaskQueueVersioningInfo",
1080910827
"description": "Specifies which Worker Deployment Version(s) Server routes this Task Queue's tasks to.\nWhen not present, it means the tasks are routed to Unversioned workers (workers with\nUNVERSIONED or unspecified WorkerVersioningMode.)\nTask Queue Versioning info is updated indirectly by calling SetWorkerDeploymentCurrentVersion\nand SetWorkerDeploymentRampingVersion on Worker Deployments.\nNote: This information is not relevant to Pinned workflow executions and their activities as\nthey are always routed to their Pinned Deployment Version. However, new workflow executions\nare typically not Pinned until they complete their first task (unless they are started with\na Pinned VersioningOverride or are Child Workflows of a Pinned parent)."
1081010828
},
10811-
"stats": {
10812-
"$ref": "#/definitions/v1TaskQueueStats",
10813-
"description": "Statistics for the task queue. Only populated when `report_stats` is set to true in the request."
10814-
},
1081510829
"config": {
1081610830
"$ref": "#/definitions/v1TaskQueueConfig",
1081710831
"description": "Only populated if report_task_queue_config is set to true."

openapi/openapiv3.yaml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7805,6 +7805,21 @@ components:
78057805
type: array
78067806
items:
78077807
$ref: '#/components/schemas/PollerInfo'
7808+
stats:
7809+
allOf:
7810+
- $ref: '#/components/schemas/TaskQueueStats'
7811+
description: |-
7812+
Statistics for the task queue.
7813+
Only set if `report_stats` is set on the request.
7814+
statsByPriorityKey:
7815+
type: object
7816+
additionalProperties:
7817+
$ref: '#/components/schemas/TaskQueueStats'
7818+
description: |-
7819+
Task queue stats breakdown by priority key. Only contains actively used priority keys.
7820+
Only set if `report_stats` is set on the request.
7821+
(-- api-linter: core::0140::prepositions=disabled
7822+
aip.dev/not-precedent: "by" is used to clarify the keys and values. --)
78087823
versioningInfo:
78097824
allOf:
78107825
- $ref: '#/components/schemas/TaskQueueVersioningInfo'
@@ -7818,10 +7833,6 @@ components:
78187833
they are always routed to their Pinned Deployment Version. However, new workflow executions
78197834
are typically not Pinned until they complete their first task (unless they are started with
78207835
a Pinned VersioningOverride or are Child Workflows of a Pinned parent).
7821-
stats:
7822-
allOf:
7823-
- $ref: '#/components/schemas/TaskQueueStats'
7824-
description: Statistics for the task queue. Only populated when `report_stats` is set to true in the request.
78257836
config:
78267837
allOf:
78277838
- $ref: '#/components/schemas/TaskQueueConfig'
@@ -7901,6 +7912,15 @@ components:
79017912
allOf:
79027913
- $ref: '#/components/schemas/TaskQueueStats'
79037914
description: Only set if `report_task_queue_stats` is set on the request.
7915+
statsByPriorityKey:
7916+
type: object
7917+
additionalProperties:
7918+
$ref: '#/components/schemas/TaskQueueStats'
7919+
description: |-
7920+
Task queue stats breakdown by priority key. Only contains actively used priority keys.
7921+
Only set if `report_task_queue_stats` is set to true in the request.
7922+
(-- api-linter: core::0140::prepositions=disabled
7923+
aip.dev/not-precedent: "by" is used to clarify the key. --)
79047924
DescribeWorkflowExecutionResponse:
79057925
type: object
79067926
properties:

temporal/api/workflowservice/v1/request_response.proto

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,16 @@ message DescribeTaskQueueRequest {
10951095
message DescribeTaskQueueResponse {
10961096
repeated temporal.api.taskqueue.v1.PollerInfo pollers = 1;
10971097

1098+
// Statistics for the task queue.
1099+
// Only set if `report_stats` is set on the request.
1100+
temporal.api.taskqueue.v1.TaskQueueStats stats = 5;
1101+
1102+
// Task queue stats breakdown by priority key. Only contains actively used priority keys.
1103+
// Only set if `report_stats` is set on the request.
1104+
// (-- api-linter: core::0140::prepositions=disabled
1105+
// aip.dev/not-precedent: "by" is used to clarify the keys and values. --)
1106+
map<int32, temporal.api.taskqueue.v1.TaskQueueStats> stats_by_priority_key = 8;
1107+
10981108
// Specifies which Worker Deployment Version(s) Server routes this Task Queue's tasks to.
10991109
// When not present, it means the tasks are routed to Unversioned workers (workers with
11001110
// UNVERSIONED or unspecified WorkerVersioningMode.)
@@ -1106,9 +1116,6 @@ message DescribeTaskQueueResponse {
11061116
// a Pinned VersioningOverride or are Child Workflows of a Pinned parent).
11071117
temporal.api.taskqueue.v1.TaskQueueVersioningInfo versioning_info = 4;
11081118

1109-
// Statistics for the task queue. Only populated when `report_stats` is set to true in the request.
1110-
temporal.api.taskqueue.v1.TaskQueueStats stats = 5;
1111-
11121119
// Only populated if report_task_queue_config is set to true.
11131120
temporal.api.taskqueue.v1.TaskQueueConfig config = 6;
11141121

@@ -2069,6 +2076,11 @@ message DescribeWorkerDeploymentVersionResponse {
20692076
temporal.api.enums.v1.TaskQueueType type = 2;
20702077
// Only set if `report_task_queue_stats` is set on the request.
20712078
temporal.api.taskqueue.v1.TaskQueueStats stats = 3;
2079+
// Task queue stats breakdown by priority key. Only contains actively used priority keys.
2080+
// Only set if `report_task_queue_stats` is set to true in the request.
2081+
// (-- api-linter: core::0140::prepositions=disabled
2082+
// aip.dev/not-precedent: "by" is used to clarify the key. --)
2083+
map<int32, temporal.api.taskqueue.v1.TaskQueueStats> stats_by_priority_key = 4;
20722084
}
20732085
}
20742086

0 commit comments

Comments
 (0)