Report costs for ordinary runs
This commit is contained in:
@@ -602,6 +602,8 @@ func (e *Engine) PrepareExecution(ctx context.Context, req RunRequest) (*Prepare
|
||||
// result on error.
|
||||
func (e *Engine) Run(ctx context.Context, req RunRequest) (*RunResult, error) {
|
||||
ctx = observation.WithoutExecutionState(ctx)
|
||||
cost := &observation.CostAccumulator{}
|
||||
ctx = observation.WithCostAccumulator(ctx, cost)
|
||||
scope := usecase.NewOperationScope(ctx, req.OperationTimeout)
|
||||
defer scope.Close()
|
||||
ctx = scope.Context
|
||||
@@ -617,6 +619,7 @@ func (e *Engine) Run(ctx context.Context, req RunRequest) (*RunResult, error) {
|
||||
return result, err
|
||||
}
|
||||
recorder, idErr := observation.New(observer)
|
||||
recorder.SetCostAccumulator(cost)
|
||||
if req.ContinueFrom != nil && req.ContinueFrom.internal != nil {
|
||||
recorder.SetParentRunID(req.ContinueFrom.internal.RunID())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user