Skip to content

Latest commit

 

History

History
65 lines (43 loc) · 2.42 KB

File metadata and controls

65 lines (43 loc) · 2.42 KB

FlexQuery.NET.Diagnostics

NuGet Version

Execution diagnostics, observability, and timeline reporting for FlexQuery.NET queries.

When to Use This Package

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.

Installation

dotnet add package FlexQuery.NET.Diagnostics

Quick Start

Attach 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();

Features

  • FlexQueryDiagnosticsCollector — Thread-safe collector capturing all pipeline stage events
  • ConsoleExecutionListener — Writes parsed queries, generated SQL with parameters, and stage timing to Console
  • Diagnostics ReportBuildReport() returns FlexQueryDiagnosticsReport with provider/translator metadata, row counts, generated SQL, exceptions, per-stage duration breakdown, and timeline
  • 4 Lifecycle EventsQueryParsed, QueryTranslated, QueryExecuted, QueryMaterialized
  • Custom Listeners — Implement IFlexQueryExecutionListener for custom logging, metrics, or OpenTelemetry integration

Related Packages

Documentation