span
What is span?
span: A single timed unit of work within a trace — one operation, with a start, duration, parent, and attributes. A span is one timed operation within a trace: a database query, an outgoing HTTP call, rendering a view or a function you chose to measure. It records when it started, how long it took, which span it belongs to, and attributes such as the SQL statement or status code.
Frequently asked questions about span
How is span used in practice?
Spans nest. A request span contains spans for each query and API call made during that request, which together show exactly where time was spent.
What should you keep in mind with span?
Automatic instrumentation creates spans for common operations. Add your own for important business steps, such as calculating shipping or generating an invoice PDF, with clear names and useful attributes. Avoid putting personal data or secrets in span attributes, since traces are usually visible to everyone with access to the monitoring tools.
What does an example of span look like?
span: "SELECT orders" parent=api duration=80ms db.system=postgres At a glance
| Category | Observability |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |