Documentation
¶
Overview ¶
Package monitoring provides performance monitoring and metrics collection for gdl downloads.
Index ¶
- type AggregatedMetrics
- type DownloadMetrics
- type MetricsCollector
- func (mc *MetricsCollector) CleanupOldMetrics()
- func (mc *MetricsCollector) Disable()
- func (mc *MetricsCollector) Enable()
- func (mc *MetricsCollector) ExportMetrics() map[string]interface{}
- func (mc *MetricsCollector) GetAggregatedMetrics() *AggregatedMetrics
- func (mc *MetricsCollector) GetAllDownloadMetrics() []*DownloadMetrics
- func (mc *MetricsCollector) GetDownloadMetrics(id string) (*DownloadMetrics, error)
- func (mc *MetricsCollector) GetPerformanceSnapshot() *PerformanceSnapshot
- func (mc *MetricsCollector) RecordDownloadComplete(id string, stats *types.DownloadStats)
- func (mc *MetricsCollector) RecordDownloadProgress(id string, bytesDownloaded, totalBytes, currentSpeed int64)
- func (mc *MetricsCollector) RecordDownloadStart(id, url string)
- func (mc *MetricsCollector) SetRetentionDuration(duration time.Duration)
- func (mc *MetricsCollector) StartPeriodicCleanup(ctx context.Context, interval time.Duration)
- type PerformanceSnapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregatedMetrics ¶
type AggregatedMetrics struct {
TotalDownloads int64
SuccessfulDownloads int64
FailedDownloads int64
TotalBytes int64
TotalDuration time.Duration
AverageSpeed float64
ThroughputMBps float64
SuccessRate float64
AverageRetries float64
AverageConcurrency float64
ProtocolBreakdown map[string]int64
ErrorBreakdown map[string]int64
LastUpdated time.Time
}
AggregatedMetrics contains aggregated metrics across all downloads
type DownloadMetrics ¶
type DownloadMetrics struct {
ID string
URL string
StartTime time.Time
EndTime time.Time
Duration time.Duration
TotalBytes int64
BytesDownloaded int64
AverageSpeed int64
MaxSpeed int64
MinSpeed int64
RetryCount int
ChunksUsed int
Success bool
ErrorType string
ErrorMessage string
Resumed bool
ConcurrencyUsed int
Protocol string
StatusCode int
}
DownloadMetrics contains metrics for a single download operation
type MetricsCollector ¶
type MetricsCollector struct {
// contains filtered or unexported fields
}
MetricsCollector collects and aggregates download performance metrics
func NewMetricsCollector ¶
func NewMetricsCollector() *MetricsCollector
NewMetricsCollector creates a new metrics collector
func (*MetricsCollector) CleanupOldMetrics ¶
func (mc *MetricsCollector) CleanupOldMetrics()
CleanupOldMetrics removes metrics older than the retention duration
func (*MetricsCollector) Disable ¶
func (mc *MetricsCollector) Disable()
Disable disables metrics collection
func (*MetricsCollector) Enable ¶
func (mc *MetricsCollector) Enable()
Enable enables metrics collection
func (*MetricsCollector) ExportMetrics ¶
func (mc *MetricsCollector) ExportMetrics() map[string]interface{}
ExportMetrics exports metrics in a structured format
func (*MetricsCollector) GetAggregatedMetrics ¶
func (mc *MetricsCollector) GetAggregatedMetrics() *AggregatedMetrics
GetAggregatedMetrics returns current aggregated metrics
func (*MetricsCollector) GetAllDownloadMetrics ¶
func (mc *MetricsCollector) GetAllDownloadMetrics() []*DownloadMetrics
GetAllDownloadMetrics returns metrics for all downloads
func (*MetricsCollector) GetDownloadMetrics ¶
func (mc *MetricsCollector) GetDownloadMetrics(id string) (*DownloadMetrics, error)
GetDownloadMetrics returns metrics for a specific download
func (*MetricsCollector) GetPerformanceSnapshot ¶
func (mc *MetricsCollector) GetPerformanceSnapshot() *PerformanceSnapshot
GetPerformanceSnapshot returns a current performance snapshot
func (*MetricsCollector) RecordDownloadComplete ¶
func (mc *MetricsCollector) RecordDownloadComplete(id string, stats *types.DownloadStats)
RecordDownloadComplete records the completion of a download operation
func (*MetricsCollector) RecordDownloadProgress ¶
func (mc *MetricsCollector) RecordDownloadProgress(id string, bytesDownloaded, totalBytes, currentSpeed int64)
RecordDownloadProgress updates progress metrics for an ongoing download
func (*MetricsCollector) RecordDownloadStart ¶
func (mc *MetricsCollector) RecordDownloadStart(id, url string)
RecordDownloadStart records the start of a download operation
func (*MetricsCollector) SetRetentionDuration ¶
func (mc *MetricsCollector) SetRetentionDuration(duration time.Duration)
SetRetentionDuration sets how long to keep individual download metrics
func (*MetricsCollector) StartPeriodicCleanup ¶
func (mc *MetricsCollector) StartPeriodicCleanup(ctx context.Context, interval time.Duration)
StartPeriodicCleanup starts a goroutine that periodically cleans up old metrics