class Azu::Handler::PerformanceMonitor

Overview

Performance monitoring handler that tracks request metrics automatically Integrates with the existing handler chain to provide transparent performance tracking

Included Modules

Defined in:

azu/handler/performance_monitor.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(metrics : PerformanceMetrics = PerformanceMetrics.new, log : Log = CONFIG.log) #

Initialize with optional custom metrics collector


[View source]

Instance Method Detail

def call(context : HTTP::Server::Context) #

[View source]
def clear_metrics #

Clear all collected metrics


[View source]
def enabled=(value : Bool) #

Enable or disable monitoring


[View source]
def enabled? #

[View source]
def endpoint_stats(endpoint : String, since : Time | Nil = nil) #

Get endpoint-specific statistics


[View source]
def generate_beautiful_report(since : Time | Nil = nil) : String #

Generate beautifully formatted performance report for terminal display


[View source]
def generate_report(since : Time | Nil = nil) : String #

Generate performance report


[View source]
def log : Log #

[View source]
def log_beautiful_report(since : Time | Nil = nil) #

Generate beautiful terminal performance report with colors and formatting


[View source]
def log_summary_report(since : Time | Nil = nil) #

Log performance summary in a compact beautiful format


[View source]
def metrics : PerformanceMetrics #

[View source]
def recent_requests(limit : Int32 = 50) #

Get recent request metrics for debugging


[View source]
def stats(since : Time | Nil = nil) #

Get current performance metrics


[View source]
def to_json(io : IO) #

Export metrics as JSON


[View source]