Isolate cost accounting for prepared executions
This commit is contained in:
@@ -110,6 +110,8 @@ func (r *Runner) RunPrepared(ctx context.Context, prepared *PreparedExecution) (
|
||||
return nil, err
|
||||
}
|
||||
defer payload.clear()
|
||||
cost := &observation.CostAccumulator{}
|
||||
ctx = observation.WithCostAccumulator(ctx, cost)
|
||||
scope := NewOperationScope(ctx, payload.operationTimeout)
|
||||
defer scope.Close()
|
||||
defer func() { err = scope.Finalize(err) }()
|
||||
@@ -121,6 +123,7 @@ func (r *Runner) RunPrepared(ctx context.Context, prepared *PreparedExecution) (
|
||||
if observer != nil {
|
||||
var idErr error
|
||||
recorder, idErr = observation.New(observer)
|
||||
recorder.SetCostAccumulator(cost)
|
||||
recorder.SetParentRunID(payload.parent.RunID())
|
||||
observation.RegisterClaim(ctx, recorder)
|
||||
ctx = observation.WithRecorder(ctx, recorder)
|
||||
|
||||
Reference in New Issue
Block a user