mirror of
https://github.com/woodchen-ink/proxy-go.git
synced 2025-07-18 16:41:54 +08:00
- Restructure Collector to use more efficient atomic operations - Remove complex caching and monitoring dependencies - Simplify path and status code tracking with sync.Map - Optimize request logging with a dedicated request queue - Remove unnecessary utility functions and pools - Streamline stats generation and reduce complexity
22 lines
469 B
Go
22 lines
469 B
Go
package models
|
|
|
|
import (
|
|
"sync/atomic"
|
|
)
|
|
|
|
type PathStats struct {
|
|
Requests atomic.Int64
|
|
Errors atomic.Int64
|
|
Bytes atomic.Int64
|
|
LatencySum atomic.Int64
|
|
}
|
|
|
|
type HistoricalMetrics struct {
|
|
Timestamp string `json:"timestamp"`
|
|
TotalRequests int64 `json:"total_requests"`
|
|
TotalErrors int64 `json:"total_errors"`
|
|
TotalBytes int64 `json:"total_bytes"`
|
|
ErrorRate float64 `json:"error_rate"`
|
|
AvgLatency float64 `json:"avg_latency"`
|
|
}
|