Documentation
¶
Index ¶
- type HealthRecord
- type HealthStore
- func (s *HealthStore) CleanupOldRecords(olderThan time.Duration) error
- func (s *HealthStore) GetHealthHistory(limit int) ([]*HealthRecord, error)
- func (s *HealthStore) GetLatestHealthRecord() (*HealthRecord, error)
- func (s *HealthStore) GetRecentHealthRecords(limit int) ([]*HealthRecord, error)
- func (s *HealthStore) ResetInProgressRecords() error
- func (s *HealthStore) StartHealthCheck() (*HealthRecord, error)
- func (s *HealthStore) UpdateHealthCheck(id int64, healthyHost bool, healthyInstances, brokenInstances []string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HealthRecord ¶
type HealthRecord struct {
ID int64 `db:"id"`
TsUnix int64 `db:"ts_unix"`
InProgress bool `db:"in_progress"`
HealthyAll bool `db:"healthy_all"`
HealthyHost bool `db:"healthy_host"`
HealthyInstances string `db:"healthy_instances"` // comma-separated
BrokenInstances string `db:"broken_instances"` // comma-separated
FailDetails string `db:"fail_details"`
}
func (*HealthRecord) GetBrokenInstancesList ¶
func (h *HealthRecord) GetBrokenInstancesList() []string
GetBrokenInstancesList returns broken instances as a slice
func (*HealthRecord) GetHealthyInstancesList ¶
func (h *HealthRecord) GetHealthyInstancesList() []string
GetHealthyInstancesList returns healthy instances as a slice
func (*HealthRecord) GetTimestamp ¶
func (h *HealthRecord) GetTimestamp() time.Time
GetTimestamp returns the timestamp as time.Time
type HealthStore ¶
type HealthStore struct {
// contains filtered or unexported fields
}
func NewHealthStore ¶
func NewHealthStore(db *sqlx.DB) *HealthStore
func (*HealthStore) CleanupOldRecords ¶
func (s *HealthStore) CleanupOldRecords(olderThan time.Duration) error
CleanupOldRecords removes health records older than the specified duration
func (*HealthStore) GetHealthHistory ¶
func (s *HealthStore) GetHealthHistory(limit int) ([]*HealthRecord, error)
GetHealthHistory returns recent health records
func (*HealthStore) GetLatestHealthRecord ¶
func (s *HealthStore) GetLatestHealthRecord() (*HealthRecord, error)
GetLatestHealthRecord returns the most recent health record
func (*HealthStore) GetRecentHealthRecords ¶
func (s *HealthStore) GetRecentHealthRecords(limit int) ([]*HealthRecord, error)
GetRecentHealthRecords returns the most recent N completed health records (excluding in_progress) Used for notification threshold evaluation
func (*HealthStore) ResetInProgressRecords ¶
func (s *HealthStore) ResetInProgressRecords() error
ResetInProgressRecords resets any stuck in_progress records on startup
func (*HealthStore) StartHealthCheck ¶
func (s *HealthStore) StartHealthCheck() (*HealthRecord, error)
StartHealthCheck creates a new health record with in_progress=true
func (*HealthStore) UpdateHealthCheck ¶
func (s *HealthStore) UpdateHealthCheck(id int64, healthyHost bool, healthyInstances, brokenInstances []string, failDetails string) error
UpdateHealthCheck updates the health record with final results