@uselumina/sdk.
initLumina(config)
Initialize the Lumina client. Parameters:| Parameter | Type | Required | Description |
|---|---|---|---|
config.endpoint | string | Yes | OTLP endpoint URL |
config.service_name | string | Yes | Service identifier |
config.enabled | boolean | No | Enable tracing (default: true) |
config.resource | object | No | Resource attributes |
Lumina instance
Example:
lumina.traceLLM(fn, options)
Trace an LLM call with automatic attribute extraction. Parameters:| Parameter | Type | Required | Description |
|---|---|---|---|
fn | () => Promise<T> | Yes | Async function returning LLM response |
options.name | string | No | Span name |
options.system | string | No | Provider (openai, anthropic) |
options.prompt | string | No | Input prompt |
options.metadata | object | No | Custom attributes |
Promise<T>
Example:
lumina.trace(name, fn)
Create a parent span for hierarchical tracing. Parameters:| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Span name |
fn | (span: Span) => Promise<T> | Yes | Async function to trace |
Promise<T>
Example:
lumina.flush()
Flush all buffered spans immediately. Returns:Promise<void>
lumina.shutdown()
Flush and shut down the SDK. Returns:Promise<void>