Documentation Index
Fetch the complete documentation index at: https://docs.hipocap.com/llms.txt
Use this file to discover all available pages before exploring further.
Laminar.flush()
Flush pending spans to the backend.// At end of script or Lambda handler
await Laminar.flush();
Returns: Promise<void>When to use:
- End of CLI scripts
- End of serverless function handlers
- Before process exit
When NOT to use:
- In web server request handlers (degrades performance)
Laminar.shutdown()
Flush spans and shut down tracing.await Laminar.shutdown();
// Can call Laminar.initialize() again if needed
Returns: Promise<void>Note: Force flushes, clears config/context, releases resources. Can re-initialize afterward.
Laminar.getHttpUrl()
Return the configured HTTP URL.Returns: string
Laminar.getProjectApiKey()
Return the configured project API key.Returns: stringLaminar.flush()
Flush pending spans to the backend.# At end of script
Laminar.flush()
Returns: bool — Success status (False if Laminar is not initialized)When to use:
- End of CLI scripts
- Graceful shutdown of web servers
When NOT to use:
- In web server request handlers (degrades performance)
Laminar.force_flush()
Force flush spans, blocking until complete. Resets context.# In AWS Lambda handler
def handler(event, context):
Laminar.initialize()
result = process(event)
Laminar.force_flush() # Blocks until spans exported
return result
Returns: NoneUse for: AWS Lambda and serverless where background threads may be killed.Behavior: Shuts down and reinitializes span processor internally. Clears isolated context—subsequent spans start new traces.
Laminar.shutdown()
Flush spans and shut down tracing.Laminar.shutdown()
# Cannot re-initialize in same process
Returns: NoneNote: Unlike JavaScript SDK, Python SDK cannot re-initialize after shutdown.
Edge Cases
- Input/output size: Values >10MB replaced with
"Laminar: ... too large to record"
- Uninitialized: If
Laminar.initialize() not called:
@observe() returns original function unchanged
- Manual span methods return
NonRecordingSpan
- Generators:
@observe() aggregates all yielded values for output recording
- Span lifecycle:
start_span/start_active_span must end in LIFO order. Violating can corrupt context hierarchy.
- Context isolation: By default,
@observe() uses isolated context. Set preserve_global_context=True to continue existing OTEL traces.
- force_flush: Clears isolated context. Subsequent spans start new traces.
Laminar.get_base_http_url()
Return the configured OTLP HTTP URL.Returns: str | None
Laminar.get_project_api_key()
Return the configured project API key.Returns: str | None