- TypeScript
- Python
Laminar.setTraceSessionId(sessionId)
Group this trace with others in a session.Parameters:| Name | Type | Description |
|---|---|---|
sessionId | string | Session identifier to attach to the trace |
voidOption A: Call inside an active span contextobserve options- Must run within an active span context to attach to the current trace.
- Prefer setting the session ID at your request/turn entry point so child spans inherit it.
Laminar.setTraceUserId(userId)
Associate trace with a user.Parameters:| Name | Type | Description |
|---|---|---|
userId | string | User identifier to attach to the trace |
voidOption A: Call inside an active span contextobserve options- Must run within an active span context to attach to the current trace.
- Prefer pseudonymous IDs (avoid emails, names, phone numbers).
Laminar.setTraceMetadata(metadata)
Add key-value metadata to the trace.Parameters:| Name | Type | Description |
|---|---|---|
metadata | Record<string, any> | JSON-serializable key-value pairs |
voidOption A: Call inside an active span contextobserve options- Must run within an active span context to attach to the current trace.
- A later call overwrites previous trace metadata—set all keys in one call.
- Values must be JSON-serializable (non-primitive values are JSON-stringified). Stored under
lmnr.association.properties.metadata.*.
Laminar.getTraceId()
Get the current trace ID.Returns:string | null — UUID string or null if no active span.