class

CogUtil::PerformanceMonitor

Inherits Reference < Object

Constructors

new(sample_buffer_size : Int32 = 10000)

Instance methods

acknowledge_alert(rule_name : String)

Acknowledge an alert

add_alert_rule(name : String, metric_pattern : String, threshold : Float64, comparison : String, duration : Time::Span, severity : String, enabled : Bool = true)

Add custom alert rule with named parameters. Convenience overload that constructs an AlertRule from individual parameters.

add_alert_rule(rule : AlertRule)

Add custom alert rule

export_monitoring_data(format : String = "json") : String

Export monitoring data

generate_monitoring_report

Generate performance monitoring report

get_active_alerts

Get active alerts

get_metric_history(name : String, duration : Time::Span = 1.hour) : Array(MetricSample)

Get recent metrics for a specific name

get_performance_summary

Get current performance summary

record_metric(name : String, value : Float64, tags : Hash(String, String) = Hash(String, String).new)

Record a performance metric

start_dashboard(port : Int32 = 8080)

Start HTTP dashboard server

start_http_server(port : Int32 = 8080)

Start HTTP server for monitoring API and WebSocket

start_monitoring(interval : Time::Span = 1.second)

Start real-time monitoring

stop_dashboard

Stop dashboard server

stop_monitoring

Stop monitoring

Nested types