Skip to content

[WiP] Deployment and TaskQueue Stats API #571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stephanos
Copy link
Contributor

@stephanos stephanos commented Apr 16, 2025

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.

What changed?

Added two new APIs:

  • GetWorkerDeploymentStats
  • GetTaskQueueStats

Why?

To return task queue stats to users for making scaling decisions.

Breaking changes

No.

Server PR

temporalio/temporal#7581

@stephanos stephanos changed the title Task Queue Stats API [WiP] Task Queue Stats API Apr 16, 2025
repeated temporal.api.taskqueue.v1.TaskQueueStatDetails per_queue_stats = 1;

// Aggregated backlog count across all task queues in this deployment version.
int64 approximate_total_backlog_count = 2;
Copy link
Contributor Author

@stephanos stephanos Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name is derived from TaskQueueStatDetails's approximate_backlog_count field.

@stephanos stephanos force-pushed the task-stats branch 8 times, most recently from 6b25fed to fa2df53 Compare April 22, 2025 21:21
@stephanos stephanos force-pushed the task-stats branch 4 times, most recently from f46f542 to 9778bd9 Compare April 28, 2025 17:15
@@ -1085,6 +1085,16 @@ message DescribeTaskQueueResponse {
temporal.api.taskqueue.v1.TaskQueueVersioningInfo versioning_info = 4;
}

message GetTaskQueueStatsRequest {
string namespace = 1;
temporal.api.taskqueue.v1.TaskQueue task_queue = 2;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this just be string instead?

@stephanos stephanos changed the title [WiP] Task Queue Stats API [WiP] Deployment and TaskQueue Stats API Apr 28, 2025

// Optional. Deployment version to return stats for.
// If left empty, the current version will be queried.
string deployment_version = 3;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to double-check that build_id isn't a better field name here.

Comment on lines +340 to +344
message TaskQueueStatsInfo {
temporal.api.taskqueue.v1.TaskQueue task_queue = 1;
temporal.api.enums.v1.TaskQueueType task_queue_type = 2;
temporal.api.taskqueue.v1.TaskQueueStats task_queue_stats = 3;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message only exists because TaskQueueStats doesn't contain the task queue name and task_queue_type.

I considered adding them to the existing TaskQueueStats, but was discouraged to do so.

@stephanos stephanos force-pushed the task-stats branch 2 times, most recently from ba4700d to 2c3d3cf Compare April 28, 2025 21:51
// GetWorkerDeploymentStats returns the stats for all task queues in a deployment version.
rpc GetWorkerDeploymentStats (GetWorkerDeploymentStatsRequest) returns (GetWorkerDeploymentStatsResponse) {
option (google.api.http) = {
get: "/namespaces/{namespace}/worker-deployments/{deployment_name}/{deployment_version}/stats"
Copy link
Contributor Author

@stephanos stephanos Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since deployment_version can be empty, I'm not sure this is right yet.

// GetTaskQueueStats returns stats for a single task queue.
rpc GetTaskQueueStats (GetTaskQueueStatsRequest) returns (GetTaskQueueStatsResponse) {
option (google.api.http) = {
post: "/namespaces/{namespace}/task-queues/{task_queue.name}/type/{task_queue_type}/get-stats"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work with the task_queue_type enum in there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant