propagateAttributes()
Attach customer identifiers and metadata to all spans in a scope.
1 await respan.propagateAttributes( 2 { 3 customer_identifier: "user_123", 4 thread_identifier: "conv_001", 5 metadata: { plan: "pro" }, 6 }, 7 async () => { 8 // All spans created here inherit these attributes 9 await respan.withWorkflow({ name: "handle_request" }, async () => { 10 const response = await client.chat.completions.create({ 11 model: "gpt-4o-mini", 12 messages: [{ role: "user", content: "Hello" }], 13 }); 14 }); 15 } 16 );
| Attribute | Type | Description |
|---|---|---|
customer_identifier | string | End user identifier |
thread_identifier | string | Conversation thread ID |
metadata | Record<string, any> | Custom key-value pairs |