Expand description
structured per-query audit record emitted by the FlightSQL service Structured per-query audit record for the FlightSQL service.
execute_query (see flight_sql_service_impl) emits one JSON-serialized
crate::servers::query_audit::QueryAuditRecord per query, at completion, under the dedicated
flightsql_query_audit log target. Unlike the untagged imetric! cost
metrics (whose properties are meant for bounded-cardinality dimensions, not
values such as SQL text), a free-text log msg has no cardinality constraint, so it can
carry both attribution and cost in one self-contained, queryable record.
peak_memory_bytes/spilled_bytes/spill_count complement the cost
fields above: the peak comes from the query’s ScopedMemoryPool (see
micromegas_analytics::lakehouse::scoped_memory_pool), while the spill
counters are summed from the physical plan tree, same as bytes_scanned.
Structs§
- Query
Audit Record - One structured record per FlightSQL query, emitted as a JSON log line under
the
flightsql_query_audittarget when the query completes, fails, or is abandoned mid-drain (client disconnect/cancel). - Scan
Metrics - Aggregated DataFusion plan metrics for one query, read after the stream drains.
Functions§
- aggregate_
scan_ metrics - Walk the physical-plan tree:
output_rowsfrom the root node (final result grain),bytes_scanned/spilled_bytes/spill_countsummed across every node (leafDataSourceExecnodes carrybytes_scanned; spilling operators such asExternalSortercarry the other two).sum_by_namecannot be used for the spill counters:MetricsSet::sum_by_nameexplicitly returnsfalseforMetricValue::SpillCount/SpilledBytes, so it would silently report zero; the dedicatedMetricsSet::spill_count()/spilled_bytes()accessors are used instead.