agrag.retrieval.tracing.retrieval_span
retrieval_span(tracer:Tracer | None, name:str, *, query:str, filters:SearchFilters | None, attributes:dict[str, Any] | None = None) -> Iterator[Span]
Open a RETRIEVER span that records the query and the scope.
Use it for retriever spans and for root spans that return
SearchResults. The caller calls record_results on the yielded span
before it exits.
Parameters:
- tracer (
Tracer | None) – The caller's tracer, or None for a no-op tracer. - name (
str) – The span name, in theagrag.retrieval.*namespace. - query (
str) – The natural-language query, or the seed's text. - filters (
SearchFilters | None) – The scope the wrapped call runs under, always recorded. - attributes (
dict[str, Any] | None) – Extra cheap attributes known before the call starts.
Yields:
Span– The open span, forrecord_resultsand any later attributes.