Skip to main content

Laminar.startSpan(options)

Create a span without activating it. Use for spans you’ll pass to other functions.
Parameters:Returns: SpanNote: Not activated—caller must propagate context manually or use withSpan.

Laminar.startActiveSpan(options)

Create and activate a span. Child spans nest automatically.
Parameters:Returns: LaminarSpan | SpanNote: Must call span.end() (recommend in finally block). Context push/pop handled automatically.

Laminar.withSpan(span, fn, endOnExit?)

Activate an existing span for the duration of a function.
Parameters:Returns: Return value of fn (or Promise if async)Note: Records exception on error. If endOnExit is true, span ends after fn (awaited if Promise).Example: Pass span objects between functions
Example: Custom span hierarchy