Skip to main content

Rust Debugging and Observability

Rust stores structured SqlLogEntry values on the trusted UserContext. Keep sql and the parameter count in application diagnostics; debug_sql and params are operator-only data.

use teaql_runtime::SqlLogOptions;

context.set_sql_log_options(SqlLogOptions::select_only());
context.clear_sql_logs();

let rows = Q::schools()
.comment("Diagnose the school search")
.purpose("Verify filters, facets, and relation loading")
.execute_for_list(&context)
.await?;

let safe = sql_evidence(&context); // projection from generated Debug Assist

Use SqlLogOptions::all(), select_only(), mutation_only(), clear_sql_logs(), and disable_sql_log(). Query and mutation switches are also independent through disable_select_sql_log() and disable_mutation_sql_log().

Run the Query, Facet, grouped aggregate, relation statistic, and deep Top-N examples from Rust advanced data operations. Inspect trace_path to separate the outer Request from each relation load; review repeated child traces for N+1 behavior and confirm Top-N stays in the provider plan.

For saves, collect mutation-only entries around .audit_as(...).save(&context) and retain the native error category. Rust Request Policy covers select, insert, update, delete, and recover, and entity data-service behavior adds a second customization boundary. Verify tenant failures and the independent SafeAuditEventSink path.

Install telemetry with context.set_runtime_telemetry(Arc::new(telemetry)). Rust also supports the environment SQL/audit levels and table/entity focus in the common guide. Rendered SQL never belongs in RuntimeTelemetry.

Finish with the shared checklist.