Skip to content

Commit

Permalink
populate workflow extended info in DescribeWorkflow (#7023)
Browse files Browse the repository at this point in the history
## What changed?
<!-- Describe what has changed in this PR -->

Populate WorkflowExtendedInfo as a part of DescribeWorfklow response.

## Why?
<!-- Tell your future self why have you made these changes -->
Feature request. Users want to see workflow expiration time as a part of
DescribeWorfklow response.


## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
Update unit tests.

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
No
  • Loading branch information
ychebotarev authored Dec 21, 2024
1 parent 26cdb1b commit ac558cd
Show file tree
Hide file tree
Showing 8 changed files with 1,871 additions and 1,836 deletions.
3,683 changes: 1,850 additions & 1,833 deletions api/historyservice/v1/request_response.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ require (
go.opentelemetry.io/otel/sdk v1.31.0
go.opentelemetry.io/otel/sdk/metric v1.31.0
go.opentelemetry.io/otel/trace v1.31.0
go.temporal.io/api v1.43.1-0.20241206174056-8a5e1486fbf5
go.temporal.io/api v1.43.1-0.20241219191931-461db5a23056
go.temporal.io/sdk v1.31.0
go.temporal.io/version v0.3.0
go.uber.org/automaxprocs v1.5.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HY
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0=
go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8=
go.temporal.io/api v1.43.1-0.20241206174056-8a5e1486fbf5 h1:/gZwoMXVPu9HouFLdNdHDgIDxtVfvuY3rqApj2ffZ20=
go.temporal.io/api v1.43.1-0.20241206174056-8a5e1486fbf5/go.mod h1:1WwYUMo6lao8yl0371xWUm13paHExN5ATYT/B7QtFis=
go.temporal.io/api v1.43.1-0.20241219191931-461db5a23056 h1:Sy8hzl/hWC/hROIXAXNaP4oTVjPMdK24jrek6im5s1s=
go.temporal.io/api v1.43.1-0.20241219191931-461db5a23056/go.mod h1:1WwYUMo6lao8yl0371xWUm13paHExN5ATYT/B7QtFis=
go.temporal.io/sdk v1.31.0 h1:CLYiP0R5Sdj0gq8LyYKDDz4ccGOdJPR8wNGJU0JGwj8=
go.temporal.io/sdk v1.31.0/go.mod h1:8U8H7rF9u4Hyb4Ry9yiEls5716DHPNvVITPNkgWUwE8=
go.temporal.io/version v0.3.0 h1:dMrei9l9NyHt8nG6EB8vAwDLLTwx2SvRyucCSumAiig=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ message DescribeWorkflowExecutionResponse {
temporal.api.workflow.v1.PendingWorkflowTaskInfo pending_workflow_task = 5;
repeated temporal.api.workflow.v1.CallbackInfo callbacks = 6;
repeated temporal.api.workflow.v1.PendingNexusOperationInfo pending_nexus_operations = 7;
temporal.api.workflow.v1.WorkflowExecutionExtendedInfo workflow_extended_info = 8;
}

message ReplicateEventsV2Request {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ message WorkflowExecutionInfo {
// Should be deprecated once the transition history is fully launched
repeated VersionedTransition previous_transition_history = 100;
VersionedTransition last_transition_history_break_point = 101;

}

message ExecutionStats {
Expand Down
1 change: 1 addition & 0 deletions service/frontend/workflow_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2777,6 +2777,7 @@ func (wh *WorkflowHandler) DescribeWorkflowExecution(ctx context.Context, reques
PendingWorkflowTask: response.GetPendingWorkflowTask(),
Callbacks: response.GetCallbacks(),
PendingNexusOperations: response.GetPendingNexusOperations(),
WorkflowExtendedInfo: response.GetWorkflowExtendedInfo(),
}, nil
}

Expand Down
10 changes: 10 additions & 0 deletions service/history/api/describeworkflow/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ func Invoke(
FirstRunId: executionInfo.FirstExecutionRunId,
VersioningInfo: executionInfo.VersioningInfo,
},
WorkflowExtendedInfo: &workflowpb.WorkflowExecutionExtendedInfo{
ExecutionExpirationTime: executionInfo.WorkflowExecutionExpirationTime,
RunExpirationTime: executionInfo.WorkflowRunExpirationTime,
OriginalStartTime: startEvent.EventTime,
CancelRequested: executionInfo.CancelRequested,
},
}

if mutableState.IsResetRun() {
result.WorkflowExtendedInfo.LastResetTime = executionState.StartTime
}

if executionInfo.ParentRunId != "" {
Expand Down
5 changes: 5 additions & 0 deletions tests/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ func (s *DescribeTestSuite) TestDescribeWorkflowExecution() {
s.Equal(id, wfInfo.RootExecution.GetWorkflowId())
s.Equal(we.RunId, wfInfo.RootExecution.GetRunId())
s.Equal(we.RunId, wfInfo.GetFirstRunId())
s.NotNil(dweResponse.WorkflowExtendedInfo)
s.Nil(dweResponse.WorkflowExtendedInfo.LastResetTime) // workflow was not reset
s.Nil(dweResponse.WorkflowExtendedInfo.ExecutionExpirationTime)
s.NotNil(dweResponse.WorkflowExtendedInfo.RunExpirationTime)
s.NotNil(dweResponse.WorkflowExtendedInfo.OriginalStartTime)

// workflow logic
workflowComplete := false
Expand Down

0 comments on commit ac558cd

Please sign in to comment.