Ray's Knowledge Base

Which View reads return dftracer metadata records

FactVerified 27 Sep 2026Holds project: dftracer-utils
Fact. A statement and the evidence for it.

Statement#

For a dftracer trace with ph="M" metadata records (such as process_name):

  • collect() returns data events only. With phase(Phase::Any) it still leaves metadata out, because collect_events drops METADATA and UNKNOWN phases after decoding.
  • phase(Phase::Metadata) returns the metadata records as rows.
  • sink_json writes the metadata records by default: an export keeps them, so a trace viewer can name threads and processes.
  • A ViewSession fold without a predicate sees what the scan emits. ViewSession::fold(f, combine) (no predicate) applies the view's own query and phase through effective_query, so it matches collect().

Compare a new read path with collect() for data rows, not with sink_json: the two differ on metadata by design.

Evidence#

  • Stage 9a test tests/trace/views/test_typed_rows.cpp, case "dftracer metadata records are left out unless selected", on a trace of 1 process_name record and 20 events: rows<T> gave 20 for the default view, 1 for phase(Metadata), and equal to collect().num_rows() (20) for phase(Any), while sink_json(...).events_matched gave 21 for both the default view and phase(Any).