health

package
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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

Jump to

Keyboard shortcuts

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