Skip to content

Commit 0d92325

Browse files
authored
Add request ID reference in links (#563)
_**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?** Add request ID reference to `Link`. <!-- Tell your future self why have you made these changes --> **Why?** Request ID can be used to associate links to history event ID. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> **Server PR**
1 parent d7bb01b commit 0d92325

File tree

5 files changed

+239
-1
lines changed

5 files changed

+239
-1
lines changed

openapi/openapiv2.json

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6724,6 +6724,9 @@
67246724
},
67256725
"eventRef": {
67266726
"$ref": "#/definitions/WorkflowEventEventReference"
6727+
},
6728+
"requestIdRef": {
6729+
"$ref": "#/definitions/WorkflowEventRequestIdReference"
67276730
}
67286731
}
67296732
},
@@ -6973,7 +6976,20 @@
69736976
"eventType": {
69746977
"$ref": "#/definitions/v1EventType"
69756978
}
6976-
}
6979+
},
6980+
"description": "EventReference is a direct reference to a history event through the event ID."
6981+
},
6982+
"WorkflowEventRequestIdReference": {
6983+
"type": "object",
6984+
"properties": {
6985+
"requestId": {
6986+
"type": "string"
6987+
},
6988+
"eventType": {
6989+
"$ref": "#/definitions/v1EventType"
6990+
}
6991+
},
6992+
"description": "RequestIdReference is a indirect reference to a history event through the request ID."
69776993
},
69786994
"WorkflowRuleActionActionActivityPause": {
69796995
"type": "object"
@@ -12390,6 +12406,25 @@
1239012406
"v1RequestCancelWorkflowExecutionResponse": {
1239112407
"type": "object"
1239212408
},
12409+
"v1RequestIdInfo": {
12410+
"type": "object",
12411+
"properties": {
12412+
"eventType": {
12413+
"$ref": "#/definitions/v1EventType",
12414+
"description": "The event type of the history event generated by the request."
12415+
},
12416+
"eventId": {
12417+
"type": "string",
12418+
"format": "int64",
12419+
"description": "The event id of the history event generated by the request. It's possible the event ID is not\nknown (unflushed buffered event). In this case, the value will be zero or a negative value,\nrepresenting an invalid ID."
12420+
},
12421+
"buffered": {
12422+
"type": "boolean",
12423+
"description": "Indicate if the request is still buffered. If so, the event ID is not known and its value\nwill be an invalid event ID."
12424+
}
12425+
},
12426+
"description": "RequestIdInfo contains details of a request ID."
12427+
},
1239312428
"v1ResetActivityResponse": {
1239412429
"type": "object"
1239512430
},
@@ -13725,6 +13760,10 @@
1372513760
"eagerWorkflowTask": {
1372613761
"$ref": "#/definitions/v1PollWorkflowTaskQueueResponse",
1372713762
"description": "When `request_eager_execution` is set on the `StartWorkflowExecutionRequest`, the server - if supported - will\nreturn the first workflow task to be eagerly executed.\nThe caller is expected to have a worker available to process the task."
13763+
},
13764+
"link": {
13765+
"$ref": "#/definitions/apicommonv1Link",
13766+
"description": "Link to the workflow event."
1372813767
}
1372913768
}
1373013769
},
@@ -14846,6 +14885,13 @@
1484614885
"resetRunId": {
1484714886
"type": "string",
1484814887
"description": "Reset Run ID points to the new run when this execution is reset. If the execution is reset multiple times, it points to the latest run."
14888+
},
14889+
"requestIdInfos": {
14890+
"type": "object",
14891+
"additionalProperties": {
14892+
"$ref": "#/definitions/v1RequestIdInfo"
14893+
},
14894+
"description": "Request ID information (eg: history event information associated with the request ID).\nNote: It only contains request IDs from StartWorkflowExecution requests, including indirect\ncalls (eg: if SignalWithStartWorkflowExecution starts a new workflow, then the request ID is\nused in the StartWorkflowExecution request)."
1484914895
}
1485014896
},
1485114897
"description": "Holds all the extra information about workflow execution that is not part of Visibility."

openapi/openapiv3.yaml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7986,6 +7986,8 @@ components:
79867986
type: string
79877987
eventRef:
79887988
$ref: '#/components/schemas/WorkflowEvent_EventReference'
7989+
requestIdRef:
7990+
$ref: '#/components/schemas/WorkflowEvent_RequestIdReference'
79897991
ListArchivedWorkflowExecutionsResponse:
79907992
type: object
79917993
properties:
@@ -9401,6 +9403,84 @@ components:
94019403
RequestCancelWorkflowExecutionResponse:
94029404
type: object
94039405
properties: {}
9406+
RequestIdInfo:
9407+
type: object
9408+
properties:
9409+
eventType:
9410+
enum:
9411+
- EVENT_TYPE_UNSPECIFIED
9412+
- EVENT_TYPE_WORKFLOW_EXECUTION_STARTED
9413+
- EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED
9414+
- EVENT_TYPE_WORKFLOW_EXECUTION_FAILED
9415+
- EVENT_TYPE_WORKFLOW_EXECUTION_TIMED_OUT
9416+
- EVENT_TYPE_WORKFLOW_TASK_SCHEDULED
9417+
- EVENT_TYPE_WORKFLOW_TASK_STARTED
9418+
- EVENT_TYPE_WORKFLOW_TASK_COMPLETED
9419+
- EVENT_TYPE_WORKFLOW_TASK_TIMED_OUT
9420+
- EVENT_TYPE_WORKFLOW_TASK_FAILED
9421+
- EVENT_TYPE_ACTIVITY_TASK_SCHEDULED
9422+
- EVENT_TYPE_ACTIVITY_TASK_STARTED
9423+
- EVENT_TYPE_ACTIVITY_TASK_COMPLETED
9424+
- EVENT_TYPE_ACTIVITY_TASK_FAILED
9425+
- EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT
9426+
- EVENT_TYPE_ACTIVITY_TASK_CANCEL_REQUESTED
9427+
- EVENT_TYPE_ACTIVITY_TASK_CANCELED
9428+
- EVENT_TYPE_TIMER_STARTED
9429+
- EVENT_TYPE_TIMER_FIRED
9430+
- EVENT_TYPE_TIMER_CANCELED
9431+
- EVENT_TYPE_WORKFLOW_EXECUTION_CANCEL_REQUESTED
9432+
- EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED
9433+
- EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED
9434+
- EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED
9435+
- EVENT_TYPE_EXTERNAL_WORKFLOW_EXECUTION_CANCEL_REQUESTED
9436+
- EVENT_TYPE_MARKER_RECORDED
9437+
- EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED
9438+
- EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED
9439+
- EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW
9440+
- EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED
9441+
- EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_FAILED
9442+
- EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_STARTED
9443+
- EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_COMPLETED
9444+
- EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_FAILED
9445+
- EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_CANCELED
9446+
- EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_TIMED_OUT
9447+
- EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_TERMINATED
9448+
- EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED
9449+
- EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED
9450+
- EVENT_TYPE_EXTERNAL_WORKFLOW_EXECUTION_SIGNALED
9451+
- EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES
9452+
- EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ADMITTED
9453+
- EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ACCEPTED
9454+
- EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_REJECTED
9455+
- EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_COMPLETED
9456+
- EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED_EXTERNALLY
9457+
- EVENT_TYPE_ACTIVITY_PROPERTIES_MODIFIED_EXTERNALLY
9458+
- EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED
9459+
- EVENT_TYPE_NEXUS_OPERATION_SCHEDULED
9460+
- EVENT_TYPE_NEXUS_OPERATION_STARTED
9461+
- EVENT_TYPE_NEXUS_OPERATION_COMPLETED
9462+
- EVENT_TYPE_NEXUS_OPERATION_FAILED
9463+
- EVENT_TYPE_NEXUS_OPERATION_CANCELED
9464+
- EVENT_TYPE_NEXUS_OPERATION_TIMED_OUT
9465+
- EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUESTED
9466+
- EVENT_TYPE_WORKFLOW_EXECUTION_OPTIONS_UPDATED
9467+
- EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_COMPLETED
9468+
- EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_FAILED
9469+
type: string
9470+
description: The event type of the history event generated by the request.
9471+
format: enum
9472+
eventId:
9473+
type: string
9474+
description: |-
9475+
The event id of the history event generated by the request. It's possible the event ID is not
9476+
known (unflushed buffered event). In this case, the value will be zero or a negative value,
9477+
representing an invalid ID.
9478+
buffered:
9479+
type: boolean
9480+
description: |-
9481+
Indicate if the request is still buffered. If so, the event ID is not known and its value
9482+
will be an invalid event ID.
9483+
description: RequestIdInfo contains details of a request ID.
94049484
ResetActivityRequest:
94059485
type: object
94069486
properties:
@@ -10919,6 +10999,10 @@ components:
1091910999
When `request_eager_execution` is set on the `StartWorkflowExecutionRequest`, the server - if supported - will
1092011000
return the first workflow task to be eagerly executed.
1092111001
The caller is expected to have a worker available to process the task.
11002+
link:
11003+
allOf:
11004+
- $ref: '#/components/schemas/Link'
11005+
description: Link to the workflow event.
1092211006
Status:
1092311007
type: object
1092411008
properties:
@@ -12048,6 +12132,75 @@ components:
1204812132
- EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_FAILED
1204912133
type: string
1205012134
format: enum
12135+
description: EventReference is a direct reference to a history event through the event ID.
12136+
WorkflowEvent_RequestIdReference:
12137+
type: object
12138+
properties:
12139+
requestId:
12140+
type: string
12141+
eventType:
12142+
enum:
12143+
- EVENT_TYPE_UNSPECIFIED
12144+
- EVENT_TYPE_WORKFLOW_EXECUTION_STARTED
12145+
- EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED
12146+
- EVENT_TYPE_WORKFLOW_EXECUTION_FAILED
12147+
- EVENT_TYPE_WORKFLOW_EXECUTION_TIMED_OUT
12148+
- EVENT_TYPE_WORKFLOW_TASK_SCHEDULED
12149+
- EVENT_TYPE_WORKFLOW_TASK_STARTED
12150+
- EVENT_TYPE_WORKFLOW_TASK_COMPLETED
12151+
- EVENT_TYPE_WORKFLOW_TASK_TIMED_OUT
12152+
- EVENT_TYPE_WORKFLOW_TASK_FAILED
12153+
- EVENT_TYPE_ACTIVITY_TASK_SCHEDULED
12154+
- EVENT_TYPE_ACTIVITY_TASK_STARTED
12155+
- EVENT_TYPE_ACTIVITY_TASK_COMPLETED
12156+
- EVENT_TYPE_ACTIVITY_TASK_FAILED
12157+
- EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT
12158+
- EVENT_TYPE_ACTIVITY_TASK_CANCEL_REQUESTED
12159+
- EVENT_TYPE_ACTIVITY_TASK_CANCELED
12160+
- EVENT_TYPE_TIMER_STARTED
12161+
- EVENT_TYPE_TIMER_FIRED
12162+
- EVENT_TYPE_TIMER_CANCELED
12163+
- EVENT_TYPE_WORKFLOW_EXECUTION_CANCEL_REQUESTED
12164+
- EVENT_TYPE_WORKFLOW_EXECUTION_CANCELED
12165+
- EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED
12166+
- EVENT_TYPE_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED
12167+
- EVENT_TYPE_EXTERNAL_WORKFLOW_EXECUTION_CANCEL_REQUESTED
12168+
- EVENT_TYPE_MARKER_RECORDED
12169+
- EVENT_TYPE_WORKFLOW_EXECUTION_SIGNALED
12170+
- EVENT_TYPE_WORKFLOW_EXECUTION_TERMINATED
12171+
- EVENT_TYPE_WORKFLOW_EXECUTION_CONTINUED_AS_NEW
12172+
- EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_INITIATED
12173+
- EVENT_TYPE_START_CHILD_WORKFLOW_EXECUTION_FAILED
12174+
- EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_STARTED
12175+
- EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_COMPLETED
12176+
- EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_FAILED
12177+
- EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_CANCELED
12178+
- EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_TIMED_OUT
12179+
- EVENT_TYPE_CHILD_WORKFLOW_EXECUTION_TERMINATED
12180+
- EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_INITIATED
12181+
- EVENT_TYPE_SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED
12182+
- EVENT_TYPE_EXTERNAL_WORKFLOW_EXECUTION_SIGNALED
12183+
- EVENT_TYPE_UPSERT_WORKFLOW_SEARCH_ATTRIBUTES
12184+
- EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ADMITTED
12185+
- EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_ACCEPTED
12186+
- EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_REJECTED
12187+
- EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_COMPLETED
12188+
- EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED_EXTERNALLY
12189+
- EVENT_TYPE_ACTIVITY_PROPERTIES_MODIFIED_EXTERNALLY
12190+
- EVENT_TYPE_WORKFLOW_PROPERTIES_MODIFIED
12191+
- EVENT_TYPE_NEXUS_OPERATION_SCHEDULED
12192+
- EVENT_TYPE_NEXUS_OPERATION_STARTED
12193+
- EVENT_TYPE_NEXUS_OPERATION_COMPLETED
12194+
- EVENT_TYPE_NEXUS_OPERATION_FAILED
12195+
- EVENT_TYPE_NEXUS_OPERATION_CANCELED
12196+
- EVENT_TYPE_NEXUS_OPERATION_TIMED_OUT
12197+
- EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUESTED
12198+
- EVENT_TYPE_WORKFLOW_EXECUTION_OPTIONS_UPDATED
12199+
- EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_COMPLETED
12200+
- EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_FAILED
12201+
type: string
12202+
format: enum
12203+
description: RequestIdReference is a indirect reference to a history event through the request ID.
1205112204
WorkflowExecution:
1205212205
type: object
1205312206
properties:
@@ -12199,6 +12352,15 @@ components:
1219912352
resetRunId:
1220012353
type: string
1220112354
description: Reset Run ID points to the new run when this execution is reset. If the execution is reset multiple times, it points to the latest run.
12355+
requestIdInfos:
12356+
type: object
12357+
additionalProperties:
12358+
$ref: '#/components/schemas/RequestIdInfo'
12359+
description: |-
12360+
Request ID information (eg: history event information associated with the request ID).
12361+
Note: It only contains request IDs from StartWorkflowExecution requests, including indirect
12362+
calls (eg: if SignalWithStartWorkflowExecution starts a new workflow, then the request ID is
12363+
used in the StartWorkflowExecution request).
1220212364
description: Holds all the extra information about workflow execution that is not part of Visibility.
1220312365
WorkflowExecutionFailedEventAttributes:
1220412366
type: object

temporal/api/common/v1/message.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,18 @@ message Callback {
219219
// workflow B, and vice-versa.
220220
message Link {
221221
message WorkflowEvent {
222+
// EventReference is a direct reference to a history event through the event ID.
222223
message EventReference {
223224
int64 event_id = 1;
224225
temporal.api.enums.v1.EventType event_type = 2;
225226
}
226227

228+
// RequestIdReference is a indirect reference to a history event through the request ID.
229+
message RequestIdReference {
230+
string request_id = 1;
231+
temporal.api.enums.v1.EventType event_type = 2;
232+
}
233+
227234
string namespace = 1;
228235
string workflow_id = 2;
229236
string run_id = 3;
@@ -232,6 +239,7 @@ message Link {
232239
// Eg: the caller workflow can send the history event details that made the Nexus call.
233240
oneof reference {
234241
EventReference event_ref = 100;
242+
RequestIdReference request_id_ref = 101;
235243
}
236244
}
237245

temporal/api/workflow/v1/message.proto

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import "google/protobuf/empty.proto";
3636
import "google/protobuf/timestamp.proto";
3737

3838
import "temporal/api/enums/v1/common.proto";
39+
import "temporal/api/enums/v1/event_type.proto";
3940
import "temporal/api/enums/v1/workflow.proto";
4041
import "temporal/api/common/v1/message.proto";
4142
import "temporal/api/deployment/v1/message.proto";
@@ -139,6 +140,12 @@ message WorkflowExecutionExtendedInfo {
139140

140141
// Reset Run ID points to the new run when this execution is reset. If the execution is reset multiple times, it points to the latest run.
141142
string reset_run_id = 6;
143+
144+
// Request ID information (eg: history event information associated with the request ID).
145+
// Note: It only contains request IDs from StartWorkflowExecution requests, including indirect
146+
// calls (eg: if SignalWithStartWorkflowExecution starts a new workflow, then the request ID is
147+
// used in the StartWorkflowExecution request).
148+
map<string, RequestIdInfo> request_id_infos = 7;
142149
}
143150

144151
// Holds all the information about worker versioning for a particular workflow execution.
@@ -550,3 +557,16 @@ message OnConflictOptions {
550557
// Attaches the links to the WorkflowExecutionOptionsUpdatedEvent history event.
551558
bool attach_links = 3;
552559
}
560+
561+
// RequestIdInfo contains details of a request ID.
562+
message RequestIdInfo {
563+
// The event type of the history event generated by the request.
564+
temporal.api.enums.v1.EventType event_type = 1;
565+
// The event id of the history event generated by the request. It's possible the event ID is not
566+
// known (unflushed buffered event). In this case, the value will be zero or a negative value,
567+
// representing an invalid ID.
568+
int64 event_id = 2;
569+
// Indicate if the request is still buffered. If so, the event ID is not known and its value
570+
// will be an invalid event ID.
571+
bool buffered = 3;
572+
}

temporal/api/workflowservice/v1/request_response.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ message StartWorkflowExecutionResponse {
225225
// return the first workflow task to be eagerly executed.
226226
// The caller is expected to have a worker available to process the task.
227227
PollWorkflowTaskQueueResponse eager_workflow_task = 2;
228+
// Link to the workflow event.
229+
temporal.api.common.v1.Link link = 4;
228230
}
229231

230232
message GetWorkflowExecutionHistoryRequest {

0 commit comments

Comments
 (0)