3
0

Support for wf exec tracing

This commit is contained in:
Denis Arh
2021-03-18 20:17:36 +01:00
parent 5faeff1ded
commit 0b1c61ba86
9 changed files with 77 additions and 33 deletions

View File

@@ -65,14 +65,19 @@ type (
sessionOpt func(*Session)
Frame struct {
CreatedAt time.Time `json:"createdAt"`
SessionID uint64 `json:"sessionID"`
StateID uint64 `json:"stateID"`
Input *expr.Vars `json:"input"`
Scope *expr.Vars `json:"scope"`
ParentID uint64 `json:"parentID"`
StepID uint64 `json:"stepID"`
LeadTime time.Duration `json:"leadTime"`
CreatedAt time.Time `json:"createdAt"`
SessionID uint64 `json:"sessionID"`
StateID uint64 `json:"stateID"`
Input *expr.Vars `json:"input"`
Scope *expr.Vars `json:"scope"`
ParentID uint64 `json:"parentID"`
StepID uint64 `json:"stepID"`
// How much time from the 1st step to the start of this step in milliseconds
ElapsedTime uint `json:"elapsedTime"`
// How much time it took to execute this step in milliseconds
StepTime uint `json:"stepTime"`
}
// ExecRequest is passed to Exec() functions and contains all information
@@ -305,7 +310,7 @@ func (s *Session) enqueue(ctx context.Context, st *State) error {
}
}
// does not wait for the whole wf to be complete but until:
// Wait does not wait for the whole wf to be complete but until:
// - context timeout
// - idle state
// - error in error queue
@@ -485,8 +490,6 @@ func (s *Session) exec(ctx context.Context, st *State) {
// }
//}()
s.eventHandler(SessionActive, st, s)
{
if currLoop != nil && currLoop.Is(st.step) {
result = currLoop

View File

@@ -137,7 +137,7 @@ func (s State) MakeFrame() *Frame {
}
if s.completed != nil {
f.LeadTime = s.completed.Sub(s.created)
f.StepTime = uint(s.completed.Sub(s.created) / time.Millisecond)
}
return f