Overview
updateCurrentSpan() allows you to modify the currently active span’s metadata, status, attributes, and Keywords AI-specific parameters.
Signature
Basic Usage
Update Status
Custom Attributes
Keywords AI Parameters
Dynamic Span Naming
Comprehensive Update
Parameters
object
Record<string, any>
Custom OpenTelemetry attributes (key-value pairs)
string
Span status:
"OK" or "ERROR"string
New name for the span (useful for dynamic naming)
Best Practices
- Update spans with customer identifiers for user-specific filtering
- Set status to ERROR when operations fail
- Use attributes for technical details (HTTP status, DB queries, etc.)
- Use Keywords AI metadata for business context (order IDs, ticket numbers, etc.)
- Update spans early in the function with identifying information
- Only call within an active span