Documentation
¶
Index ¶
- func InitializeKeyHealthMonitor(monitoringConfig config.MonitoringConfig) error
- func StopKeyHealthMonitor()
- type DatabaseHealthCheck
- type DiskInfo
- type HealthCheck
- type HealthChecker
- type HealthMonitor
- func (hm *HealthMonitor) GetHealthStatus() HealthResponse
- func (hm *HealthMonitor) HealthHandler(c echo.Context) error
- func (hm *HealthMonitor) LivenessHandler(c echo.Context) error
- func (hm *HealthMonitor) MetricsHandler(c echo.Context) error
- func (hm *HealthMonitor) ReadinessHandler(c echo.Context) error
- func (hm *HealthMonitor) RegisterCheck(checker HealthChecker)
- type HealthResponse
- type HealthStatus
- type HealthSummary
- type KeyComponent
- type KeyHealthCheck
- type KeyHealthMonitor
- type KeyHealthStatus
- type StorageHealthCheck
- type SystemHealthCheck
- type SystemInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeKeyHealthMonitor ¶
func InitializeKeyHealthMonitor(monitoringConfig config.MonitoringConfig) error
InitializeKeyHealthMonitor initializes the global key health monitor
func StopKeyHealthMonitor ¶
func StopKeyHealthMonitor()
StopKeyHealthMonitor stops the global key health monitor
Types ¶
type DatabaseHealthCheck ¶
type DatabaseHealthCheck struct {
// contains filtered or unexported fields
}
DatabaseHealthCheck checks database connectivity
func (*DatabaseHealthCheck) Check ¶
func (d *DatabaseHealthCheck) Check() HealthCheck
func (*DatabaseHealthCheck) Name ¶
func (d *DatabaseHealthCheck) Name() string
type DiskInfo ¶
type DiskInfo struct { Total uint64 `json:"total"` Used uint64 `json:"used"` Available uint64 `json:"available"` UsedPct float64 `json:"used_percent"` }
DiskInfo provides disk usage information
type HealthCheck ¶
type HealthCheck struct { Name string `json:"name"` Status HealthStatus `json:"status"` Message string `json:"message,omitempty"` Duration time.Duration `json:"duration"` Timestamp time.Time `json:"timestamp"` Details map[string]string `json:"details,omitempty"` LastSuccess *time.Time `json:"last_success,omitempty"` LastFailure *time.Time `json:"last_failure,omitempty"` }
HealthCheck represents a single health check result
type HealthChecker ¶
type HealthChecker interface { Check() HealthCheck Name() string }
HealthChecker interface for implementing health checks
type HealthMonitor ¶
type HealthMonitor struct {
// contains filtered or unexported fields
}
HealthMonitor manages health checks and monitoring
func NewHealthMonitor ¶
NewHealthMonitor creates a new health monitor
func (*HealthMonitor) GetHealthStatus ¶
func (hm *HealthMonitor) GetHealthStatus() HealthResponse
GetHealthStatus performs all health checks and returns the status
func (*HealthMonitor) HealthHandler ¶
func (hm *HealthMonitor) HealthHandler(c echo.Context) error
HealthHandler returns the complete health status
func (*HealthMonitor) LivenessHandler ¶
func (hm *HealthMonitor) LivenessHandler(c echo.Context) error
LivenessHandler returns liveness status (minimal check)
func (*HealthMonitor) MetricsHandler ¶
func (hm *HealthMonitor) MetricsHandler(c echo.Context) error
MetricsHandler returns Prometheus-compatible metrics
func (*HealthMonitor) ReadinessHandler ¶
func (hm *HealthMonitor) ReadinessHandler(c echo.Context) error
ReadinessHandler returns readiness status (simplified health check)
func (*HealthMonitor) RegisterCheck ¶
func (hm *HealthMonitor) RegisterCheck(checker HealthChecker)
RegisterCheck registers a new health check
type HealthResponse ¶
type HealthResponse struct { Status HealthStatus `json:"status"` Timestamp time.Time `json:"timestamp"` Version string `json:"version"` Uptime time.Duration `json:"uptime"` Checks map[string]HealthCheck `json:"checks"` System SystemInfo `json:"system"` Summary HealthSummary `json:"summary"` }
HealthResponse represents the complete health check response
type HealthStatus ¶
type HealthStatus string
HealthStatus represents the overall health status
const ( StatusHealthy HealthStatus = "healthy" StatusDegraded HealthStatus = "degraded" StatusUnhealthy HealthStatus = "unhealthy" )
type HealthSummary ¶
type HealthSummary struct { Total int `json:"total"` Healthy int `json:"healthy"` Degraded int `json:"degraded"` Unhealthy int `json:"unhealthy"` }
HealthSummary provides summary statistics
type KeyComponent ¶
type KeyComponent struct { Name string `json:"name"` Type string `json:"type"` // "opaque_server", "jwt_signing", "tls_cert", "entity_id" Path string `json:"path"` // File path or identifier Status KeyHealthStatus `json:"status"` LastChecked time.Time `json:"last_checked"` NextCheck time.Time `json:"next_check"` Details map[string]interface{} `json:"details"` AlertLevel string `json:"alert_level"` ErrorMessage string `json:"error_message,omitempty"` }
KeyComponent represents a monitored cryptographic component
type KeyHealthCheck ¶
type KeyHealthCheck struct {
// contains filtered or unexported fields
}
KeyHealthCheck checks cryptographic key health
func (*KeyHealthCheck) Check ¶
func (k *KeyHealthCheck) Check() HealthCheck
func (*KeyHealthCheck) Name ¶
func (k *KeyHealthCheck) Name() string
type KeyHealthMonitor ¶
type KeyHealthMonitor struct {
// contains filtered or unexported fields
}
KeyHealthMonitor monitors the health of cryptographic keys and certificates
var DefaultKeyHealthMonitor *KeyHealthMonitor
Global key health monitor instance
func NewKeyHealthMonitor ¶
func NewKeyHealthMonitor(db *sql.DB, monitoringConfig config.MonitoringConfig) *KeyHealthMonitor
NewKeyHealthMonitor creates a new key health monitor
func (*KeyHealthMonitor) GetHealthStatus ¶
func (khm *KeyHealthMonitor) GetHealthStatus() ([]KeyComponent, error)
GetHealthStatus returns the current health status of all components
func (*KeyHealthMonitor) PerformHealthCheck ¶
func (khm *KeyHealthMonitor) PerformHealthCheck()
PerformHealthCheck performs a comprehensive health check of all key components
func (*KeyHealthMonitor) Start ¶
func (khm *KeyHealthMonitor) Start()
Start begins the key health monitoring routine
func (*KeyHealthMonitor) Stop ¶
func (khm *KeyHealthMonitor) Stop()
Stop stops the key health monitoring routine
type KeyHealthStatus ¶
type KeyHealthStatus string
KeyHealthStatus represents the health status of a cryptographic component
const ( HealthStatusHealthy KeyHealthStatus = "healthy" HealthStatusWarning KeyHealthStatus = "warning" HealthStatusCritical KeyHealthStatus = "critical" HealthStatusUnknown KeyHealthStatus = "unknown" )
type StorageHealthCheck ¶
type StorageHealthCheck struct {
// contains filtered or unexported fields
}
StorageHealthCheck checks storage backend connectivity
func (*StorageHealthCheck) Check ¶
func (s *StorageHealthCheck) Check() HealthCheck
func (*StorageHealthCheck) Name ¶
func (s *StorageHealthCheck) Name() string
type SystemHealthCheck ¶
type SystemHealthCheck struct{}
SystemHealthCheck checks system resources
func (*SystemHealthCheck) Check ¶
func (s *SystemHealthCheck) Check() HealthCheck
func (*SystemHealthCheck) Name ¶
func (s *SystemHealthCheck) Name() string
type SystemInfo ¶
type SystemInfo struct { GoVersion string `json:"go_version"` NumGoroutine int `json:"num_goroutine"` NumCPU int `json:"num_cpu"` MemStats struct { Alloc uint64 `json:"alloc"` TotalAlloc uint64 `json:"total_alloc"` Sys uint64 `json:"sys"` NumGC uint32 `json:"num_gc"` LastGC string `json:"last_gc"` } `json:"memory"` DiskUsage map[string]DiskInfo `json:"disk_usage"` }
SystemInfo provides system-level information