Documentation
¶
Index ¶
- type HealthChecker
- func (h *HealthChecker) CheckHealth() HealthStatus
- func (h *HealthChecker) GetHealthScore() int
- func (h *HealthChecker) IsHealthy() bool
- func (h *HealthChecker) RecordRequest(success bool, latency time.Duration, isTimeout bool)
- func (h *HealthChecker) Reset()
- func (h *HealthChecker) UpdateResourceMetrics(activeConns int64, poolUtil float64, memUsage int64)
- type HealthStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HealthChecker ¶
type HealthChecker struct {
// contains filtered or unexported fields
}
HealthChecker provides comprehensive health monitoring for the HTTP client
func NewHealthChecker ¶
func NewHealthChecker() *HealthChecker
NewHealthChecker creates a new health checker with default thresholds
func (*HealthChecker) CheckHealth ¶
func (h *HealthChecker) CheckHealth() HealthStatus
CheckHealth performs a comprehensive health check
func (*HealthChecker) GetHealthScore ¶
func (h *HealthChecker) GetHealthScore() int
GetHealthScore returns the current health score (0-100)
func (*HealthChecker) IsHealthy ¶
func (h *HealthChecker) IsHealthy() bool
IsHealthy returns the current health status
func (*HealthChecker) RecordRequest ¶
func (h *HealthChecker) RecordRequest(success bool, latency time.Duration, isTimeout bool)
RecordRequest records a request completion
func (*HealthChecker) Reset ¶
func (h *HealthChecker) Reset()
Reset resets all metrics (useful for testing)
func (*HealthChecker) UpdateResourceMetrics ¶
func (h *HealthChecker) UpdateResourceMetrics(activeConns int64, poolUtil float64, memUsage int64)
UpdateResourceMetrics updates resource utilization metrics
type HealthStatus ¶
type HealthStatus struct {
IsHealthy bool
HealthScore int
TotalRequests int64
SuccessRate float64
FailureRate float64
TimeoutRate float64
AverageLatency time.Duration
MaxLatency time.Duration
MinLatency time.Duration
ActiveConnections int64
PoolUtilization float64
MemoryUsage int64
LastCheck time.Time
Issues []string
}
HealthStatus represents the current health status