Execution diagnostics, observability, and timeline reporting for FlexQuery.NET queries.
Install this package when you need to inspect, measure, or monitor FlexQuery.NET execution.
It provides execution listeners, timing reports, and pipeline diagnostics for debugging, performance analysis, and observability.
dotnet add package FlexQuery.NET.DiagnosticsAttach a listener through the per-execution options of your provider:
using FlexQuery.NET.Diagnostics;
var collector = new FlexQueryDiagnosticsCollector();
var result = await _context.Users.FlexQueryAsync(parameters, options =>
{
options.AllowedFields = new HashSet<string> { "Id", "Name" };
options.Listener = collector; // receives pipeline lifecycle events
});
var report = collector.BuildReport();
Console.WriteLine($"Total: {report.Duration.TotalMs}ms");
Console.WriteLine($" Parse: {report.Duration.ParseMs}ms");
Console.WriteLine($" Translate: {report.Duration.TranslateMs}ms");
Console.WriteLine($" Database: {report.Duration.DatabaseMs}ms");
Console.WriteLine($" Materialize: {report.Duration.MaterializeMs}ms");
foreach (var entry in report.Timeline)
Console.WriteLine($"{entry.Stage}: {entry.DurationMs}ms");For quick debugging, swap in the console listener:
options.Listener = new ConsoleExecutionListener();FlexQueryDiagnosticsCollector— Thread-safe collector capturing all pipeline stage eventsConsoleExecutionListener— Writes parsed queries, generated SQL with parameters, and stage timing toConsole- Diagnostics Report —
BuildReport()returnsFlexQueryDiagnosticsReportwith provider/translator metadata, row counts, generated SQL, exceptions, per-stage duration breakdown, and timeline - 4 Lifecycle Events —
QueryParsed,QueryTranslated,QueryExecuted,QueryMaterialized - Custom Listeners — Implement
IFlexQueryExecutionListenerfor custom logging, metrics, or OpenTelemetry integration
- FlexQuery.NET — Core query engine