Skip to main content

Module monitoring

Module monitoring 

Source
Expand description

MySQL broker monitoring utilities

This module provides production-grade monitoring and analysis utilities for MySQL-based task queues. These utilities help with capacity planning, autoscaling decisions, SLA monitoring, and performance optimization.

§Examples

use celers_broker_sql::monitoring::*;

// Analyze consumer lag and get scaling recommendations
let queue_size = 1000;
let processing_rate = 50.0; // messages/sec
let lag = analyze_mysql_consumer_lag(queue_size, processing_rate, 100);
println!("Queue lag: {} seconds", lag.lag_seconds);
println!("Recommendation: {:?}", lag.recommendation);

// Calculate message velocity and growth trends
let velocity = calculate_mysql_message_velocity(
    1000, // previous size
    1500, // current size
    60.0  // time window (seconds)
);
println!("Queue growing at {} msg/sec", velocity.velocity);

// Get worker scaling recommendation
let scaling = suggest_mysql_worker_scaling(
    2000,  // queue_size
    5,     // current_workers
    40.0,  // avg_processing_rate (msg/sec per worker)
    100    // target_lag_seconds
);
println!("Suggested workers: {}", scaling.recommended_workers);

Structs§

AlertThresholds
Alert threshold recommendations
CapacityForecast
Capacity forecast for future load
ConsumerLagAnalysis
Consumer lag analysis with autoscaling recommendations
MessageAgeDistribution
Message age distribution for SLA monitoring
MessageVelocity
Message velocity and queue growth trend
MysqlCostAnalysis
Cost analysis for MySQL broker operations
ProcessingCapacity
Processing capacity estimation
SlaComplianceReport
SLA compliance tracking
WorkerScalingSuggestion
Worker scaling suggestion

Enums§

CapacityStatus
Capacity status
QueueTrend
Queue growth trend classification
ScalingRecommendation
Worker scaling recommendation
SlaStatus
SLA compliance status

Functions§

analyze_mysql_broker_performance
Analyze MySQL broker performance metrics
analyze_mysql_consumer_lag
Analyze consumer lag and provide scaling recommendations
calculate_alert_thresholds
Calculate recommended alert thresholds
calculate_mysql_message_age_distribution
Calculate message age distribution for SLA monitoring
calculate_mysql_message_velocity
Calculate message velocity and queue growth trend
calculate_mysql_queue_health_score
Calculate MySQL queue health score (0.0 - 1.0)
calculate_sla_compliance
Calculate SLA compliance report
estimate_mysql_operational_cost
Estimate MySQL broker operational costs
estimate_mysql_processing_capacity
Estimate processing capacity of the MySQL broker system
forecast_capacity_needs
Forecast capacity needs based on growth trends
suggest_mysql_worker_scaling
Suggest worker scaling based on queue metrics