Documentation ¶
Index ¶
- type Monitor
- type State
- type Store
- func (s *Store) CreateTx(ctx context.Context, tx *sql.Tx, m *Monitor) (*Monitor, error)
- func (s *Store) DeleteTx(ctx context.Context, tx *sql.Tx, ids ...string) error
- func (s *Store) FindAllByService(ctx context.Context, serviceID string) ([]Monitor, error)
- func (s *Store) FindMany(ctx context.Context, ids []string) ([]Monitor, error)
- func (s *Store) FindOneTx(ctx context.Context, tx *sql.Tx, id string) (*Monitor, error)
- func (s *Store) RecordHeartbeat(ctx context.Context, id string) error
- func (s *Store) UpdateTx(ctx context.Context, tx *sql.Tx, m *Monitor) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Monitor ¶
type Monitor struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` ServiceID string `json:"service_id,omitempty"` Timeout time.Duration `json:"timeout,omitempty"` // contains filtered or unexported fields }
A Monitor will generate an alert if it does not receive a heartbeat within the configured TimeoutMinutes.
func (Monitor) LastHeartbeat ¶ added in v0.24.0
LastHeartbeat returns the timestamp of the last successful heartbeat.
type State ¶
type State string
State represents the health of a heartbeat monitor.
const ( // StateInactive means the heartbeat has not yet reported for the first time. StateInactive State = "inactive" // StateHealthy indicates a heartbeat was received within the past interval. StateHealthy State = "healthy" // StateUnhealthy indicates a heartbeat has not been received since beyond the interval. StateUnhealthy State = "unhealthy" )
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages heartbeat checks and recording heartbeats.
func (*Store) FindAllByService ¶
FindAllByService returns all heartbeats belonging to the given service ID.
func (*Store) FindMany ¶ added in v0.24.0
FindMany returns the heartbeat monitors with the given IDs.
The order and number of returned monitors is not guaranteed.
func (*Store) RecordHeartbeat ¶ added in v0.28.0
RecordHeartbeat records a heartbeat for the given heartbeat ID.
Click to show internal directories.
Click to hide internal directories.