Timeline
Time-travel debugging with execution timelines
Timeline
The Timeline system records every significant event during a workflow execution, allowing for detailed auditing and time-travel debugging.
StepflowTimeline
The StepflowTimeline recorder captures events like step starts, completions, failures, and sleeps.
import { createTimeline } from "@stepflowjs/observability";
const timeline = createTimeline({
config: {
enabled: true,
maxEntries: 10000,
},
});Recording Events
Events are typically recorded automatically by the Stepflow engine, but you can also record custom events.
timeline.record({
type: "custom",
executionId: "exec_123",
workflowId: "my-workflow",
data: { message: "Something happened" },
});Retrieving Timeline
You can retrieve the full history of an execution to visualize it or debug issues.
const entries = timeline.getEntries("exec_123");
entries.forEach((entry) => {
console.log(`${entry.timestamp.toISOString()}: ${entry.type}`);
});Timeline Entry Types
Stepflow records a wide variety of event types:
execution:start,execution:complete,execution:failedstep:start,step:complete,step:failed,step:cached,step:retrysleep:start,sleep:completeevent:wait,event:received,event:timeoutlog:debug,log:info,log:warn,log:error
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Whether timeline recording is enabled |
maxEntries | number | 10000 | Max entries to keep in memory per execution |
persistToStorage | boolean | false | Whether to persist timeline to storage |