Skip to main content
Use the spans module to search project spans and perform span-level maintenance such as deleting spans or adding notes.

Relevant Source Files

  • src/spans/getSpans.ts for the exact filter names and query behavior

Search Spans

getSpans returns spans in insertion order, most recently inserted first, which is not always the order in which they started. To page by start time, call GET /v1/projects/{project_identifier}/spans with sort=start_time, or use get_spans(sort="start_time") in the Python client (Phoenix server 20.16.0 or newer).

Filtering by Attributes

Use the attributes parameter to filter spans by OpenInference attribute key-value pairs. Multiple entries are ANDed together. The JS type of the value determines how the stored attribute is matched: a number matches a stored integer or float, a boolean matches a stored boolean, and a string matches a stored string.
Non-finite number values (Infinity, NaN) throw a RangeError. Requires Phoenix server ≥ 14.9.0.

Root Span Queries

Use parentId: null to limit results to root spans only.

Span Maintenance

Adding Notes

Use addSpanNote to attach a free-text note to a span. Multiple notes can be added to the same span — they are independent entries, each with its own timestamp.

Deleting Spans

deleteSpan accepts either the OpenTelemetry span_id or Phoenix’s global span ID. For span-level annotations (labels, scores, evaluations), see Span Annotations and Document Annotations.

Source Map

  • src/spans/getSpans.ts
  • src/spans/addSpanNote.ts
  • src/spans/deleteSpan.ts
  • src/spans/getSpanAnnotations.ts
  • src/types/spans.ts