Overview
When building complex applications, you often need to continue traces across different parts of your system:- Function boundaries where traces need to span multiple function calls
- Service boundaries where traces cross different microservices
- Async operations where traces need to be maintained across async boundaries
- Request handlers where different API endpoints handle parts of the same user journey
Passing Span Objects
The most direct way to continue traces is by passing span objects between functions.Use
Laminar.startSpan()
and Laminar.withSpan()
to create and continue spans:Remember to call
span.end()
to complete the trace. You can also pass true
as the third argument (endOnExit
) to the last Laminar.withSpan()
call to automatically end the span.