Documentation Index
Fetch the complete documentation index at: https://docs.uselumina.io/docs/llms.txt
Use this file to discover all available pages before exploring further.
Advanced patterns for complex workflows.
Multi-Span Tracing
Track complex workflows with hierarchical spans:
const result = await lumina.trace('rag_pipeline', async (parentSpan) => {
parentSpan.setAttribute('query', userQuery);
// Child span 1: Vector search
const docs = await lumina.trace('retrieval', async () => {
return await vectorDB.search(userQuery);
});
// Child span 2: LLM synthesis
const response = await lumina.traceLLM(
() => llm.generate(buildPrompt(userQuery, docs)),
{ name: 'synthesis', system: 'anthropic' }
);
return response;
});
Span Attributes
Add custom attributes to spans:
await lumina.trace('operation', async (span) => {
span.setAttribute('userId', 'user-123');
span.setAttribute('priority', 'high');
span.addEvent('processing_started');
// Your code here
span.addEvent('processing_completed');
});
Graceful Shutdown
Always flush before exit:
process.on('SIGTERM', async () => {
await lumina.shutdown();
process.exit(0);
});
Next Steps
API Reference
Complete API documentation
Multi-Span Guide
Detailed multi-span guide