Skip to content

Analytics

SLOzy provides automated anomaly detection and SLO recommendations based on historical metric patterns.

Anomaly Detection

The anomaly_detections table (migrations/000011) captures automated findings:

sql
CREATE TABLE anomaly_detections (
    id SERIAL PRIMARY KEY,
    slo_id INT NOT NULL REFERENCES slos(id),
    detection_time TIMESTAMPTZ NOT NULL,
    anomaly_type VARCHAR(50) NOT NULL CHECK (anomaly_type IN (
        'burn_rate_spike', 'latency_degradation',
        'error_budget_critical', 'metrics_unavailable',
        'unexpected_pattern'
    )),
    severity VARCHAR(20) CHECK (severity IN ('low', 'medium', 'high', 'critical')),
    confidence_score NUMERIC(5,4),    -- 0.0000 to 1.0000
    current_value NUMERIC(20,6),      -- current metric value (e.g., burn rate)
    baseline_value NUMERIC(20,6),     -- 7-day moving average baseline
    anomaly_reason TEXT,
    is_resolved BOOLEAN DEFAULT FALSE
);

Anomalies are classified by type and severity with a confidence score. The system compares current values against a baseline (e.g., 7-day moving average) to detect deviations.

SLO Recommendations

The slo_recommendations table (migrations/000012) provides actionable suggestions:

sql
CREATE TABLE slo_recommendations (
    recommendation_type VARCHAR(50) CHECK (recommendation_type IN (
        'target_adjustment', 'threshold_adjustment',
        'metric_query_optimization', 'alert_threshold_change',
        'monitoring_frequency_change'
    )),
    severity VARCHAR(20) DEFAULT 'info',
    message TEXT NOT NULL,
    recommended_value VARCHAR(255),
    rationale TEXT,
    expires_at TIMESTAMPTZ DEFAULT NOW() + INTERVAL '30 days'
);

Recommendations are generated with a 30-day expiration and can be dismissed individually. A background cleanup function (cleanup_expired_recommendations()) removes stale suggestions.