Diagnostics — Aquilia Documentation
Comprehensive guide and documentation for Diagnostics in the Aquilia framework. View API reference, examples, and implementation patterns.
Dependency Injection / Diagnostics DI Diagnostics & Observability The diagnostics module under aquilia/di/diagnostics.py exposes runtime events, resolution timing metrics, and validation tracers. Opt-in for zero hot-path cost. Resolution events (RESOLUTION_START/SUCCESS/FAILURE) are only emitted when the diagnostics_enabled DI setting is on — keeping the default resolve path free of tracing overhead. Turn it on per-environment in your workspace.py di block (commonly DevEnv): class DevEnv(BaseEnv): class di(BaseEnv.di): diagnostics_enabled = True DIEventType Event Emitted When Metadata ))} ConsoleDiagnosticListener A built-in diagnostic listener that formats DI events to log targets. Perfect for local dev debugging: from aquilia.di import DIDiagnostics, ConsoleDiagnosticListener # Register the console diagnostic event listener listener = ConsoleDiagnosticListener() container._diagnostics.register_listener(listener) # Resolutions will now dump trace profiles into standard error: # [DI] RESOLUTION_START: token=myapp.services.UserService tag=None # [DI] PROVIDER_INSTANTIATION: token=myapp.services.UserService duration=0.0012s # [DI] RESOLUTION_SUCCESS: token=myapp.services.UserService duration=0.0014s CLI Commands Manage and check your dependency injection setup using the aq command line interface: aq di-check Verifies cyclic loops, scope matching, app isolation, and missing providers. aq di-check --settings settings.py aq di-tree Prints a clean text tree representing the entire DI hierarchy. aq di-tree --settings settings.py --root UserService aq di-graph Generates a Graphviz DOT visualization. aq di-graph --settings settings.py --out graph.dot aq di-profile Benchmarks DI cold start and warm O(1) resolution latency profiles. aq di-profile --settings settings.py --bench resolve Lifecycle )
Go to Homepage