Skip to content

Commit 6341435

Browse files
committed
work on comments
1 parent 4940812 commit 6341435

3 files changed

Lines changed: 58 additions & 28 deletions

File tree

temporal/api/worker/v1/message.proto

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ option csharp_namespace = "Temporalio.Api.Worker.V1";
1212

1313
import "google/protobuf/duration.proto";
1414
import "google/protobuf/timestamp.proto";
15+
import "temporal/api/deployment/v1/message.proto";
1516

1617

1718
message WorkerTaskStatus {
@@ -29,31 +30,47 @@ message WorkerTaskStatus {
2930
float failure_rate_min = 8;
3031
}
3132

33+
// Holds everything needed to identify the host/process context
34+
message WorkerHostInfo {
35+
// worker host identifier, should be unique for the namespace.
36+
string host_id = 1;
37+
38+
// worker process identifier, should be unique for the host.
39+
string process_id = 2;
40+
41+
// freeform (e.g. "k8s container abc123", etc.)
42+
string host_context = 3;
43+
44+
// Worker identity, set by the worker, may not be unique.
45+
string worker_identity = 7;
46+
}
47+
3248
message WorkerStatus {
33-
string namespace_id = 1;
34-
// Unique identifier for the namespace.
35-
string worker_id = 2;
49+
// Worker identifier, should be unique for the namespace. Required.
50+
string worker_id = 1;
51+
52+
// Worker host information. Required.
53+
WorkerHostInfo host_info = 2;
3654

37-
string host_id = 3;
38-
string task_queue = 4;
39-
string deployment_name = 5;
40-
string build_id = 6;
41-
string sdk_name = 7;
42-
string sdk_version = 8;
55+
// Task queue this worker is polling for tasks. Required.
56+
string task_queue = 3;
4357

44-
string worker_identity = 9;
58+
// Required.
59+
temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 4;
4560

46-
int32 worker_status = 10;
47-
google.protobuf.Duration uptime = 11;
61+
string sdk_name = 6;
62+
string sdk_version = 7;
4863

49-
google.protobuf.Timestamp last_heartbeat_time = 12;
64+
google.protobuf.Duration uptime = 9;
65+
google.protobuf.Timestamp last_heartbeat_time = 10;
5066

51-
WorkerTaskStatus workflow_task_status = 13;
52-
WorkerTaskStatus activity_task_status = 14;
53-
WorkerTaskStatus nexus_task_status = 15;
67+
WorkerTaskStatus workflow_task_status = 11;
68+
WorkerTaskStatus activity_task_status = 12;
69+
WorkerTaskStatus nexus_task_status = 13;
5470

55-
float cpu_usage_percent = 16;
56-
int64 memory_usage_bytes = 17;
57-
float cache_hit_ratio = 18;
58-
float cache_size = 19;
71+
float cpu_usage_percent = 14;
72+
int64 memory_usage_bytes = 15;
73+
float cache_hit_ratio = 16;
74+
float max_cache_size = 17;
75+
float available_cache_size = 18;
5976
}

temporal/api/workflowservice/v1/request_response.proto

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,7 +2328,7 @@ message TriggerWorkflowRuleResponse {
23282328
// True is the rule was applied, based on the rule conditions (predicate/visibility_query).
23292329
bool applied = 1;
23302330
}
2331-
message WorkerHeartbeatRequest {
2331+
message RecordWorkerHeartbeatRequest {
23322332
// Namespace of the workflow which scheduled this activity.
23332333
string namespace = 1;
23342334

@@ -2338,18 +2338,31 @@ message WorkerHeartbeatRequest {
23382338
temporal.api.worker.v1.WorkerStatus worker_status = 3;
23392339
}
23402340

2341-
message WorkerHeartbeatResponse {
2341+
message RecordWorkerHeartbeatResponse {
23422342

23432343
}
23442344

2345-
message ListWorkerStatusRequest {
2345+
// `query` in ListWorkers is used to filter workers based on worker status info.
2346+
// The following worker status attributes are expected are supported as part of the query:
2347+
//* WorkerId
2348+
//* HostId
2349+
//* TaskQueue
2350+
//* DeploymentName
2351+
//* BuildId
2352+
//* SdkName
2353+
//* SdkVersion
2354+
//* Uptime
2355+
//* LastHeartbeatTime
2356+
//* Status
2357+
// Currently metrics are not supported as a part of ListWorkers query.
2358+
message ListWorkersRequest {
23462359
string namespace = 1;
23472360
int32 page_size = 2;
23482361
bytes next_page_token = 3;
23492362
string query = 4;
23502363
}
23512364

2352-
message ListWorkerStatusResponse {
2365+
message ListWorkersResponse {
23532366
repeated temporal.api.worker.v1.WorkerStatus worker_status = 1;
23542367

23552368
// Next page token

temporal/api/workflowservice/v1/service.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,19 +1174,19 @@ service WorkflowService {
11741174
}
11751175

11761176
// WorkerHeartbeat receive heartbeat request from the worker.
1177-
rpc WorkerHeartbeat(WorkerHeartbeatRequest) returns (WorkerHeartbeatResponse) {
1177+
rpc RecordWorkerHeartbeat(RecordWorkerHeartbeatRequest) returns (RecordWorkerHeartbeatResponse) {
11781178
option (google.api.http) = {
11791179
post: "/namespaces/{namespace}/worker-heartbeat"
11801180
body: "*"
11811181
additional_bindings {
1182-
post: "/api/v1/namespaces/{namespace}/worker-heartbeat"
1182+
post: "/api/v1/namespaces/{namespace}/workers/heartbeat"
11831183
body: "*"
11841184
}
11851185
};
11861186
};
11871187

1188-
// ListWorkerStatus is a visibility API to list worker status information in a specific namespace.
1189-
rpc ListWorkerStatus (ListWorkerStatusRequest) returns (ListWorkerStatusResponse) {
1188+
// ListWorkers is a visibility API to list worker status information in a specific namespace.
1189+
rpc ListWorkers (ListWorkersRequest) returns (ListWorkersResponse) {
11901190
option (google.api.http) = {
11911191
get: "/namespaces/{namespace}/workers"
11921192
additional_bindings {

0 commit comments

Comments
 (0)