← Back to Node.js performance mapspans
✍️
Node.js Performance
Manual Spans
Add custom spans around business operations.
Detailed Description
Manual spans add business meaning that auto-instrumentation cannot know. They let you name operations like placeOrder, calculatePrice, reserveInventory, or sendInvoice.
Add attributes carefully: include IDs and categories that help debugging, but avoid secrets, large payloads, and high-cardinality values that make tracing expensive.
Mental Model
start span -> do work -> add attributes -> end span
When To Use
- ->Auto-instrumentation is too generic
- ->You need domain-specific span names
- ->You want to mark cache hits, user IDs, or job names
Tools: trace.getTracer, span attributes, error recording
manual-span.js
Live Editor
Loading...
Output
Run code to see output...