Add a workflow executor-I/O observation example handling ExecutorInvokedEvent and ExecutorCompletedEvent - #736
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Go workflow observability example demonstrating how to trace per-executor inputs and outputs by consuming workflow.ExecutorInvokedEvent alongside workflow.ExecutorCompletedEvent on the streaming event bus, and registers it for deterministic verification.
Changes:
- Added
examples/03-workflows/observability/executor_io/main.go, a two-node (uppercase → reverse) workflow that prints invoked/completed events per executor plus output/error events. - Registered the new example in
cmd/verifyexamples/examples.gowith deterministicMustContainassertions covering invoked/completed lines for both executors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| examples/03-workflows/observability/executor_io/main.go | New observability example printing per-executor invoked/completed I/O from the workflow event stream. |
| cmd/verifyexamples/examples.go | Registers the new example with deterministic substring checks for invoked/completed output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment has been minimized.
This comment has been minimized.
Add examples/03-workflows/observability/executor_io demonstrating how to observe per-executor input and output by handling ExecutorInvokedEvent and ExecutorCompletedEvent from the workflow event stream. The existing 01_streaming sample only surfaces ExecutorCompletedEvent output, so there was no example showing the input each node receives via ExecutorInvokedEvent. Register the deterministic example in cmd/verifyexamples so its invoked and completed output lines are checked.
f1978bd to
b6ae98d
Compare
Parity Review ✅This PR adds No new exported Go APIs introduced. The example uses only existing exported types. Cross-repo parity confirmed:
No parity issues found. The Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
What
Adds
examples/03-workflows/observability/executor_io/main.go, a small event-stream observability example that builds a two-executor workflow (uppercase -> reverse, mirroring01_streaming), runs it viainproc.Default.RunStreaming, and in therun.WatchStreamloop handles bothExecutorInvokedEvent(the inputMessageeach node received) andExecutorCompletedEvent(theResulteach node produced), plusOutputEvent,ExecutorFailedEvent, andErrorEvent.It is registered as a deterministic example in
cmd/verifyexamples/examples.go, asserting the per-executor invoked and completed lines appear in stdout.Why
workflow.ExecutorInvokedEventis exported and emitted on the workflow event stream, but no example referenced it. The one existing event-stream sample (01_streaming) switches only onExecutorCompletedEvent/OutputEvent/ErrorEvent/ExecutorFailedEvent, so it surfaces per-executor output but never the per-executor input. This example fills that gap and documents the full input->output trace of each node.This matches the .NET/Python observability samples, which show both the executor-invoke and executor-complete events to give a complete per-executor I/O view, keeping the Go port aligned on which lifecycle events are demonstrated.
Testing
go build ./...,go vet ./...pass.go run ./examples/03-workflows/observability/executor_io/prints aninvokedline carrying the inputMessageand acompletedline carrying theResultfor each executor ID, confirmingExecutorInvokedEventis emitted and matched.go test ./cmd/verifyexamples/andgo test ./workflow/pass; the new deterministic entry checks the invoked/completed output.No provider or credentials needed since plain function executors suffice.