feat(daemon): the timeline names and links the binding and capture that started a task
This commit is contained in:
1 parent
8613d2564c
commit
e16d06d588
8 files changed
+47
-25
No files matched your search
+11
-10
@@ -708,9 +708,7 @@ func (d *Daemon) claimAndEnqueue(ctx context.Context, b binding.Binding, c store
|
||||
if err := d.BindingDispatcher.SetDispatchTask(ctx, b.ID, c.ID, task.ID); err != nil {
|
||||
d.Log.Warn("binding dispatch: record task", "binding", b.ID, "capture", c.ID, "task", task.ID, "error", err)
|
||||
}
|
||||
if c.Unsigned {
|
||||
d.markUnsignedStart(ctx, task.ID, b, c)
|
||||
}
|
||||
d.markBindingStart(ctx, task.ID, b, c)
|
||||
}
|
||||
|
||||
// authorizeDispatch checks the identity may run the workflow. A denial is
|
||||
@@ -762,16 +760,19 @@ func signatureOf(c storecontract.CapturedEvent) string {
|
||||
return "unverified"
|
||||
}
|
||||
|
||||
// markUnsignedStart records on a task's timeline that an unsigned event
|
||||
// started it.
|
||||
func (d *Daemon) markUnsignedStart(ctx context.Context, taskID int64, b binding.Binding, c storecontract.CapturedEvent) {
|
||||
// markBindingStart records on a task's timeline the binding and captured
|
||||
// event that started it.
|
||||
func (d *Daemon) markBindingStart(ctx context.Context, taskID int64, b binding.Binding, c storecontract.CapturedEvent) {
|
||||
if _, err := d.Store.InsertEvent(ctx, events.Event{
|
||||
TaskID: taskID,
|
||||
Kind: events.KindUnsignedEvent,
|
||||
Detail: fmt.Sprintf("started by an unsigned event from source %q", c.Source),
|
||||
Data: map[string]any{"source": c.Source, "capture_id": c.ID, "binding_id": b.ID},
|
||||
Kind: events.KindBindingStarted,
|
||||
Detail: fmt.Sprintf("started by binding %q from source %q", b.Name, c.Source),
|
||||
Data: map[string]any{
|
||||
"binding_id": b.ID, "binding_name": b.Name, "binding_version": b.Version,
|
||||
"capture_id": c.ID, "source": c.Source, "unsigned": c.Unsigned,
|
||||
},
|
||||
}); err != nil {
|
||||
d.Log.Warn("binding dispatch: unsigned marker", "task", taskID, "error", err)
|
||||
d.Log.Warn("binding dispatch: start marker", "task", taskID, "error", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,10 +89,12 @@ const (
|
||||
KindBindingChanged = "binding_changed"
|
||||
KindMappingChanged = "mapping_changed"
|
||||
|
||||
// KindUnsignedEvent marks a task started by an event from an approved
|
||||
// unsigned source, so its timeline shows that nothing authenticated
|
||||
// the sender. data: source, capture_id, binding_id.
|
||||
KindUnsignedEvent = "unsigned_event"
|
||||
// KindBindingStarted marks a task a binding started from a captured
|
||||
// event, naming both so the timeline links to them; unsigned flags an
|
||||
// event from an approved unsigned source, which nothing authenticated.
|
||||
// data: binding_id, binding_name, binding_version, capture_id, source,
|
||||
// unsigned.
|
||||
KindBindingStarted = "binding_started"
|
||||
|
||||
// KindWorkflowCallStarted marks the moment a workflow.call step
|
||||
// started its callee run. data:
|
||||
|
||||
Reference in new issue
Block a user