propagateAttributes()

Attach customer identifiers and metadata to all spans in a scope.
await respan.propagateAttributes(
{
customer_identifier: "user_123",
thread_identifier: "conv_001",
metadata: { plan: "pro" },
},
async () => {
// All spans created here inherit these attributes
await respan.withWorkflow({ name: "handle_request" }, async () => {
const response = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hello" }],
});
});
}
);
AttributeTypeDescription
customer_identifierstringEnd user identifier
thread_identifierstringConversation thread ID
metadataRecord<string, any>Custom key-value pairs