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§
- Alert
Thresholds - Alert threshold recommendations
- Capacity
Forecast - Capacity forecast for future load
- Consumer
LagAnalysis - Consumer lag analysis with autoscaling recommendations
- Message
AgeDistribution - Message age distribution for SLA monitoring
- Message
Velocity - Message velocity and queue growth trend
- Mysql
Cost Analysis - Cost analysis for MySQL broker operations
- Processing
Capacity - Processing capacity estimation
- SlaCompliance
Report - SLA compliance tracking
- Worker
Scaling Suggestion - Worker scaling suggestion
Enums§
- Capacity
Status - Capacity status
- Queue
Trend - Queue growth trend classification
- Scaling
Recommendation - 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