propagateAttributes()

Attach customer identifiers and metadata to all spans in a scope.
1await 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);
AttributeTypeDescription
customer_identifierstringEnd user identifier
thread_identifierstringConversation thread ID
metadataRecord<string, any>Custom key-value pairs