healthcheck

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatHealthMessage

func FormatHealthMessage(result HealthCheckResult, targetURL *url.URL) string

FormatHealthMessage creates a user-friendly health status message

Types

type HealthCheckResult

type HealthCheckResult struct {
	Status    ServerHealthStatus
	Healthy   bool
	Error     error
	Timestamp time.Time
	Duration  time.Duration
}

HealthCheckResult contains the result of a health check

func CheckServerHealth

func CheckServerHealth(targetURL *url.URL, timeout time.Duration) HealthCheckResult

CheckServerHealth performs a TCP connection check to verify a server is listening. The timeout parameter should be appropriate for the deployment context: - Local development: 3s is typically sufficient - Production/edge: May require longer timeouts due to network conditions

type ServerHealthStatus

type ServerHealthStatus int

ServerHealthStatus represents the health status of the target server

const (
	HealthHealthy     ServerHealthStatus = iota // TCP connection successful
	HealthUnreachable                           // Connection refused or timeout
)

Jump to

Keyboard shortcuts

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