Why Flows?
In any non-trivial application, a single user action triggers multiple log events across different functions, services, or even machines. Without flows, correlating these events means manually matching timestamps, user IDs, or request IDs — which breaks down quickly. Flows solve this by giving each operation a uniqueflowId and automatically numbering each step, so you get a complete, ordered timeline of what happened.
Flow Anatomy
Every log in a flow carries two extra fields:| Field | Description |
|---|---|
| flowId | Unique identifier linking all logs in the flow (e.g., checkout-a1b2c3d4) |
| stepIndex | Auto-incrementing position in the sequence (0, 1, 2, …) |
checkout from checkout-a1b2c3d4).
Flow ID Generation
Flow IDs follow the pattern{name}-{random8chars}:
Use Cases
Flows are ideal for tracking:- Checkout processes — cart validation, payment, order creation, confirmation
- API request lifecycles — receive, authenticate, process, respond
- Background jobs — start, process items, complete or fail
- User journeys — sign-up, onboarding steps, activation
- Data pipelines — ingest, transform, validate, store
Step Indexing
Each log in a flow automatically receives an incrementingstepIndex, starting at 0. This preserves the order of operations regardless of when logs arrive at the server.
Level Filtering Behavior
WhenminLevel is configured, filtered logs do not increment the step index:
Cross-Service Correlation
Flows can span multiple services by passing theflowId between them. For example, an API server can start a flow and pass the flow ID to a background worker via a job queue. The worker then logs with the same flowId, continuing the sequence. This gives you a unified timeline across service boundaries.
Best Practices
Name Flows Descriptively
Use names that clearly describe the operation:Include Context in the First Log
The first log in a flow should capture the key identifiers and parameters for the operation — user ID, order ID, item count, etc. This makes it easy to find and understand the flow later.Log Completion
Always log the outcome of a flow, whether it succeeds or fails. This makes it clear whether a flow completed normally or was interrupted.Keep Flows Focused
Each flow should represent a single logical operation. If an operation triggers sub-operations, consider creating separate flows for each rather than nesting everything in one.Further Reading
- SDK Flow Tracking: TypeScript | Python — how to create and use flows in code
- Flow Timeline — viewing and analyzing flows in the dashboard