Files
tasks/service/history/workflow/transaction.go
Vladyslav SimonenkoandGitHub 6575698580 Produce workflow_duration metric on completion (#8185)
## What changed?
This PR produces the metric workflow_duration, when the workflow
execution completes.

## Why?
Currently there is no metric that captures the duration of the workflow
execution. It's also valuable to have the duration broken down by task
queue, namespace, workflow type, which this PR enables

## How did you test it?
- [X] built
- [X] run locally and tested manually
- [X] covered by existing tests
- [X] added new unit test(s)
- [ ] added new functional test(s)
2025-08-13 15:34:38 -07:00

54 lines
1.7 KiB
Go

package workflow
import (
"context"
"go.temporal.io/server/common/persistence"
)
//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination transaction_mock.go
type (
Transaction interface {
CreateWorkflowExecution(
ctx context.Context,
createMode persistence.CreateWorkflowMode,
newWorkflowFailoverVersion int64,
newWorkflowSnapshot *persistence.WorkflowSnapshot,
newWorkflowEventsSeq []*persistence.WorkflowEvents,
isWorkflow bool,
) (int64, error)
ConflictResolveWorkflowExecution(
ctx context.Context,
conflictResolveMode persistence.ConflictResolveWorkflowMode,
resetWorkflowFailoverVersion int64,
resetWorkflowSnapshot *persistence.WorkflowSnapshot,
resetWorkflowEventsSeq []*persistence.WorkflowEvents,
newWorkflowFailoverVersion *int64,
newWorkflowSnapshot *persistence.WorkflowSnapshot,
newWorkflowEventsSeq []*persistence.WorkflowEvents,
currentWorkflowFailoverVersion *int64,
currentWorkflowMutation *persistence.WorkflowMutation,
currentWorkflowEventsSeq []*persistence.WorkflowEvents,
isWorkflow bool,
) (int64, int64, int64, error)
UpdateWorkflowExecution(
ctx context.Context,
updateMode persistence.UpdateWorkflowMode,
currentWorkflowFailoverVersion int64,
currentWorkflowMutation *persistence.WorkflowMutation,
currentWorkflowEventsSeq []*persistence.WorkflowEvents,
newWorkflowFailoverVersion *int64,
newWorkflowSnapshot *persistence.WorkflowSnapshot,
newWorkflowEventsSeq []*persistence.WorkflowEvents,
isWorkflow bool,
) (int64, int64, error)
SetWorkflowExecution(
ctx context.Context,
workflowSnapshot *persistence.WorkflowSnapshot,
) error
}
)