Expand description
Profile-mode instrumentation for the pull executor.
When a MetricsCollector is installed via [install_collector], the
pull builder wraps each operator’s RowSource in a [MeteredSource]
that records, for that operator id:
next_calls: number ofnext_rowinvocations.rows: number ofSome(_)rows produced.elapsed_ns: cumulative wall-clock time spent insidenext_row, inclusive of time spent pulling from upstream operators. This matches the “operator + descendants” view that is most actionable when reading a profile.
The collector is installed for the lifetime of one query through a
thread-local guard; the executor is single-threaded per-query, so this
is safe and avoids threading an extra parameter through every source
constructor. Outside profile() calls the thread-local is None and
wrap_metered returns its argument unchanged — execute() and
streaming reads pay nothing.
Structs§
- Collector
Guard - RAII guard. While alive, the thread-local current collector is set to the supplied collector; on drop it is cleared.
- Metrics
Collector - Shared accumulator. Pass an
Arcclone to eachMeteredSourceso every operator writes into the same map. - Operator
Profile - Per-operator metrics collected during a profile run.