const result = await tracer.trace(async (ctx) => {
// ctx is TraceContext with traceId already set
console.log('Trace ID:', ctx.traceId);
// All spans created here share this traceId
return await processRequest(ctx);
}, {
name: 'process-request', // Optional trace name
traceId: 'custom-id', // Optional: provide your own trace ID
convoId: 'conv-123', // Optional: conversation/session ID
input: userQuery, // Optional: trace-level input
properties: { // Optional: custom metadata
userId: 'user-123'
}
});