class
Azu::PerformanceMetrics
- Azu::PerformanceMetrics
- Reference
- Object
Overview
Performance metrics collection and analysis system Tracks request processing times, memory usage, component lifecycle, and error rates
Defined in:
azu/performance_metrics.crConstructors
Class Method Summary
-
.current_memory_usage : Int64
Get current memory usage
-
.time_cache_operation(metrics : PerformanceMetrics, key : String, operation : String, store_type : String, key_size : Int32 = 0, value_size : Int32 | Nil = nil, ttl : Time::Span | Nil = nil, &)
Helper method to time and record cache operations
Instance Method Summary
-
#aggregate_stats(since : Time | Nil = nil) : AggregatedStats
Get aggregated statistics
-
#cache_operation_breakdown(since : Time | Nil = nil) : Hash(String, Hash(String, Float64))
Get cache operation breakdown by operation type
-
#cache_stats(store_type : String | Nil = nil, since : Time | Nil = nil) : Hash(String, Float64)
Get cache statistics
-
#clear
Clear all metrics
-
#component_stats(component_type : String | Nil = nil, since : Time | Nil = nil) : Hash(String, Float64)
Get component statistics
- #enabled : Bool
-
#enabled=(enabled : Bool)
Enable/disable metrics collection
-
#endpoint_stats(endpoint : String, since : Time | Nil = nil) : Hash(String, Float64)
Get endpoint-specific statistics
-
#recent_caches(limit : Int32 = 100) : Array(CacheMetric)
Get recent cache metrics
-
#recent_components(limit : Int32 = 100) : Array(ComponentMetric)
Get recent component metrics
-
#recent_requests(limit : Int32 = 100) : Array(RequestMetric)
Get recent request metrics
-
#record_cache(key : String, operation : String, store_type : String, processing_time : Float64, hit : Bool | Nil = nil, key_size : Int32 = 0, value_size : Int32 | Nil = nil, ttl : Time::Span | Nil = nil, error : String | Nil = nil)
Record a cache operation metric
-
#record_component(component_id : String, component_type : String, event : String, processing_time : Float64 | Nil = nil, memory_before : Int64 | Nil = nil, memory_after : Int64 | Nil = nil, age_at_event : Time::Span | Nil = nil)
Record a component lifecycle metric
-
#record_request(endpoint : String, method : String, path : String, processing_time : Float64, memory_before : Int64, memory_after : Int64, status_code : Int32, request_id : String | Nil = nil)
Record a request metric
- #start_time : Time
-
#to_json(io : IO) : Nil
Export metrics to JSON
Constructor Detail
Class Method Detail
Helper method to time and record cache operations
Instance Method Detail
Get aggregated statistics
Get cache operation breakdown by operation type
Get cache statistics
Get component statistics
Get endpoint-specific statistics
Get recent cache metrics
Get recent component metrics
Get recent request metrics
Record a cache operation metric
Record a component lifecycle metric
Record a request metric