monitoring

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL