diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 93e23d89..09f10e63 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -1610,6 +1610,55 @@ ] } }, + "/api/v1/namespaces/{namespace}/task-queues/{taskQueue}/type/{taskQueueType}/get-stats": { + "post": { + "summary": "GetTaskQueueStats returns stats for a single task queue.", + "operationId": "GetTaskQueueStats2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetTaskQueueStatsResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "taskQueue", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "taskQueueType", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "TASK_QUEUE_TYPE_UNSPECIFIED", + "TASK_QUEUE_TYPE_WORKFLOW", + "TASK_QUEUE_TYPE_ACTIVITY", + "TASK_QUEUE_TYPE_NEXUS" + ] + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/api/v1/namespaces/{namespace}/task-queues/{taskQueue}/worker-build-id-compatibility": { "get": { "summary": "Deprecated. Use `GetWorkerVersioningRules`.\nFetches the worker build id versioning sets for a task queue.", @@ -2080,6 +2129,51 @@ ] } }, + "/api/v1/namespaces/{namespace}/worker-deployments/{deploymentName}/stats": { + "get": { + "summary": "GetWorkerDeploymentStats returns the stats for all task queues in a deployment version.", + "operationId": "GetWorkerDeploymentStats2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetWorkerDeploymentStatsResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentName", + "description": "Name of the deployment to return stats for.\n", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "buildId", + "description": "Optional. Build ID to return stats for.\nIf left empty, the deployment's current one will be queried.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/api/v1/namespaces/{namespace}/worker-task-reachability": { "get": { "summary": "Deprecated. Use `DescribeTaskQueue`.", @@ -5123,6 +5217,55 @@ ] } }, + "/namespaces/{namespace}/task-queues/{taskQueue}/type/{taskQueueType}/get-stats": { + "post": { + "summary": "GetTaskQueueStats returns stats for a single task queue.", + "operationId": "GetTaskQueueStats", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetTaskQueueStatsResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "taskQueue", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "taskQueueType", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "TASK_QUEUE_TYPE_UNSPECIFIED", + "TASK_QUEUE_TYPE_WORKFLOW", + "TASK_QUEUE_TYPE_ACTIVITY", + "TASK_QUEUE_TYPE_NEXUS" + ] + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/namespaces/{namespace}/task-queues/{taskQueue}/worker-build-id-compatibility": { "get": { "summary": "Deprecated. Use `GetWorkerVersioningRules`.\nFetches the worker build id versioning sets for a task queue.", @@ -5554,6 +5697,51 @@ ] } }, + "/namespaces/{namespace}/worker-deployments/{deploymentName}/stats": { + "get": { + "summary": "GetWorkerDeploymentStats returns the stats for all task queues in a deployment version.", + "operationId": "GetWorkerDeploymentStats", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetWorkerDeploymentStatsResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentName", + "description": "Name of the deployment to return stats for.\n", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "buildId", + "description": "Optional. Build ID to return stats for.\nIf left empty, the deployment's current one will be queried.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/namespaces/{namespace}/worker-task-reachability": { "get": { "summary": "Deprecated. Use `DescribeTaskQueue`.", @@ -10306,6 +10494,14 @@ }, "description": "System capability details." }, + "v1GetTaskQueueStatsResponse": { + "type": "object", + "properties": { + "taskQueueStats": { + "$ref": "#/definitions/v1TaskQueueStats" + } + } + }, "v1GetWorkerBuildIdCompatibilityResponse": { "type": "object", "properties": { @@ -10320,6 +10516,24 @@ }, "title": "[cleanup-wv-pre-release]" }, + "v1GetWorkerDeploymentStatsResponse": { + "type": "object", + "properties": { + "perQueueMetrics": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1TaskQueueStatsInfo" + }, + "title": "Collection of stats for all task queues in the requested deployment.\nNote that the data is" + }, + "approximateTotalBacklogCount": { + "type": "string", + "format": "int64", + "title": "The sum of backlog counts across all task queues in the deployment.\nNote that same as the task queue metrics, this value is" + } + } + }, "v1GetWorkerTaskReachabilityResponse": { "type": "object", "properties": { @@ -13984,6 +14198,20 @@ }, "description": "TaskQueueStats contains statistics about task queue backlog and activity.\n\nFor workflow task queue type, this result is partial because tasks sent to sticky queues are not included. Read\ncomments above each metric to understand the impact of sticky queue exclusion on that metric accuracy." }, + "v1TaskQueueStatsInfo": { + "type": "object", + "properties": { + "taskQueue": { + "$ref": "#/definitions/v1TaskQueue" + }, + "taskQueueType": { + "$ref": "#/definitions/v1TaskQueueType" + }, + "taskQueueStats": { + "$ref": "#/definitions/v1TaskQueueStats" + } + } + }, "v1TaskQueueStatus": { "type": "object", "properties": { diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index dd5d4016..a659962b 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -1300,6 +1300,47 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /api/v1/namespaces/{namespace}/task-queues/{taskQueue}/type/{taskQueueType}/get-stats: + post: + tags: + - WorkflowService + description: GetTaskQueueStats returns stats for a single task queue. + operationId: GetTaskQueueStats + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: taskQueue + in: path + required: true + schema: + type: string + - name: taskQueueType + in: path + required: true + schema: + enum: + - TASK_QUEUE_TYPE_UNSPECIFIED + - TASK_QUEUE_TYPE_WORKFLOW + - TASK_QUEUE_TYPE_ACTIVITY + - TASK_QUEUE_TYPE_NEXUS + type: string + format: enum + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetTaskQueueStatsResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /api/v1/namespaces/{namespace}/task-queues/{taskQueue}/worker-build-id-compatibility: get: tags: @@ -1842,6 +1883,47 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /api/v1/namespaces/{namespace}/worker-deployments/{deploymentName}/stats: + get: + tags: + - WorkflowService + description: GetWorkerDeploymentStats returns the stats for all task queues in a deployment version. + operationId: GetWorkerDeploymentStats + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: deploymentName + in: path + description: |- + Name of the deployment to return stats for. + + (-- api-linter: core::0122::name-suffix=disabled + required: true + schema: + type: string + - name: buildId + in: query + description: |- + Optional. Build ID to return stats for. + If left empty, the deployment's current one will be queried. + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetWorkerDeploymentStatsResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /api/v1/namespaces/{namespace}/worker-task-reachability: get: tags: @@ -4420,6 +4502,47 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /namespaces/{namespace}/task-queues/{taskQueue}/type/{taskQueueType}/get-stats: + post: + tags: + - WorkflowService + description: GetTaskQueueStats returns stats for a single task queue. + operationId: GetTaskQueueStats + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: taskQueue + in: path + required: true + schema: + type: string + - name: taskQueueType + in: path + required: true + schema: + enum: + - TASK_QUEUE_TYPE_UNSPECIFIED + - TASK_QUEUE_TYPE_WORKFLOW + - TASK_QUEUE_TYPE_ACTIVITY + - TASK_QUEUE_TYPE_NEXUS + type: string + format: enum + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetTaskQueueStatsResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /namespaces/{namespace}/task-queues/{taskQueue}/worker-build-id-compatibility: get: tags: @@ -4929,6 +5052,47 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /namespaces/{namespace}/worker-deployments/{deploymentName}/stats: + get: + tags: + - WorkflowService + description: GetWorkerDeploymentStats returns the stats for all task queues in a deployment version. + operationId: GetWorkerDeploymentStats + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: deploymentName + in: path + description: |- + Name of the deployment to return stats for. + + (-- api-linter: core::0122::name-suffix=disabled + required: true + schema: + type: string + - name: buildId + in: query + description: |- + Optional. Build ID to return stats for. + If left empty, the deployment's current one will be queried. + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetWorkerDeploymentStatsResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /namespaces/{namespace}/worker-task-reachability: get: tags: @@ -7600,6 +7764,11 @@ components: True if the server supports Nexus operations. This flag is dependent both on server version and for Nexus to be enabled via server configuration. description: System capability details. + GetTaskQueueStatsResponse: + type: object + properties: + taskQueueStats: + $ref: '#/components/schemas/TaskQueueStats' GetWorkerBuildIdCompatibilityResponse: type: object properties: @@ -7614,6 +7783,21 @@ components: There may be fewer sets returned than exist, if the request chose to limit this response. description: '[cleanup-wv-pre-release]' + GetWorkerDeploymentStatsResponse: + type: object + properties: + perQueueMetrics: + type: array + items: + $ref: '#/components/schemas/TaskQueueStatsInfo' + description: |- + Collection of stats for all task queues in the requested deployment. + Note that the data is + approximateTotalBacklogCount: + type: string + description: |- + The sum of backlog counts across all task queues in the deployment. + Note that same as the task queue metrics, this value is GetWorkerTaskReachabilityResponse: type: object properties: @@ -11220,6 +11404,21 @@ components: 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. + TaskQueueStatsInfo: + type: object + properties: + taskQueue: + $ref: '#/components/schemas/TaskQueue' + taskQueueType: + enum: + - TASK_QUEUE_TYPE_UNSPECIFIED + - TASK_QUEUE_TYPE_WORKFLOW + - TASK_QUEUE_TYPE_ACTIVITY + - TASK_QUEUE_TYPE_NEXUS + type: string + format: enum + taskQueueStats: + $ref: '#/components/schemas/TaskQueueStats' TaskQueueStatus: type: object properties: diff --git a/temporal/api/taskqueue/v1/message.proto b/temporal/api/taskqueue/v1/message.proto index 53ddfec8..ef3576ac 100644 --- a/temporal/api/taskqueue/v1/message.proto +++ b/temporal/api/taskqueue/v1/message.proto @@ -336,3 +336,9 @@ message PollerScalingDecision { // all slots are already occupied. int32 poll_request_delta_suggestion = 1; } + +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; +} \ No newline at end of file diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 357303c9..c976ddf6 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -1085,6 +1085,16 @@ message DescribeTaskQueueResponse { temporal.api.taskqueue.v1.TaskQueueVersioningInfo versioning_info = 4; } +message GetTaskQueueStatsRequest { + string namespace = 1; + string task_queue = 2; + temporal.api.enums.v1.TaskQueueType task_queue_type = 3; +} + +message GetTaskQueueStatsResponse { + temporal.api.taskqueue.v1.TaskQueueStats task_queue_stats = 1; +} + message GetClusterInfoRequest { } @@ -2207,6 +2217,29 @@ message GetDeploymentReachabilityResponse { google.protobuf.Timestamp last_update_time = 3; } +message GetWorkerDeploymentStatsRequest { + string namespace = 1; + + // Name of the deployment to return stats for. + // + // (-- api-linter: core::0122::name-suffix=disabled + string deployment_name = 2; + + // Optional. Build ID to return stats for. + // If left empty, the deployment's current one will be queried. + string build_id = 3; +} + +message GetWorkerDeploymentStatsResponse { + // Collection of stats for all task queues in the requested deployment. + // Note that the data is + repeated temporal.api.taskqueue.v1.TaskQueueStatsInfo per_queue_metrics = 1; + + // The sum of backlog counts across all task queues in the deployment. + // Note that same as the task queue metrics, this value is + int64 approximate_total_backlog_count = 2; +} + message CreateWorkflowRuleRequest { string namespace = 1; diff --git a/temporal/api/workflowservice/v1/service.proto b/temporal/api/workflowservice/v1/service.proto index 18dacc1b..fc7ce0e6 100644 --- a/temporal/api/workflowservice/v1/service.proto +++ b/temporal/api/workflowservice/v1/service.proto @@ -582,6 +582,16 @@ service WorkflowService { }; } + // GetTaskQueueStats returns stats for a single task queue. + rpc GetTaskQueueStats (GetTaskQueueStatsRequest) returns (GetTaskQueueStatsResponse) { + option (google.api.http) = { + post: "/namespaces/{namespace}/task-queues/{task_queue}/type/{task_queue_type}/get-stats" + additional_bindings { + post: "/api/v1/namespaces/{namespace}/task-queues/{task_queue}/type/{task_queue_type}/get-stats" + } + }; + } + // GetClusterInfo returns information about temporal cluster rpc GetClusterInfo(GetClusterInfoRequest) returns (GetClusterInfoResponse) { option (google.api.http) = { @@ -878,6 +888,16 @@ service WorkflowService { }; } + // 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}/stats" + additional_bindings { + get: "/api/v1/namespaces/{namespace}/worker-deployments/{deployment_name}/stats" + } + }; + } + // Deletes records of (an old) Deployment. A deployment can only be deleted if // it has no Version in it. // Experimental. This API might significantly change or be removed in a future release. @@ -890,7 +910,6 @@ service WorkflowService { }; } - // Used for manual deletion of Versions. User can delete a Version only when all the // following conditions are met: // - It is not the Current or Ramping Version of its Deployment. @@ -1194,5 +1213,4 @@ service WorkflowService { } }; } - }