doctor

package
v0.0.0-...-69e95d2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const (
	HealthcheckTypeContainerRuntime = "ContainerRuntime"
	HealthcheckTypeAgent            = "Agent"
	HealthcheckTypeEBSDaemon        = "EBSDaemon"
)

Variables

View Source
var (
	// EmptyHealthcheckError indicates an error when there are no healthcheck metrics to report
	EmptyHealthcheckError = errors.New("No instance healthcheck status metrics to report")
)

Functions

This section is empty.

Types

type Doctor

type Doctor struct {
	// contains filtered or unexported fields
}

func NewDoctor

func NewDoctor(healthchecks []Healthcheck, cluster string, containerInstanceArn string) (*Doctor, error)

func (*Doctor) AddHealthcheck

func (doc *Doctor) AddHealthcheck(healthcheck Healthcheck)

AddHealthcheck adds a healthcheck to the list of healthchecks that the doctor will run every time doctor.RunHealthchecks() is called

func (*Doctor) GetCluster

func (doc *Doctor) GetCluster() string

GetCluster returns the cluster that was provided to the doctor while being initialized

func (*Doctor) GetContainerInstanceArn

func (doc *Doctor) GetContainerInstanceArn() string

GetContainerInstanceArn returns the container instance arn that was provided to the doctor while being initialized

func (*Doctor) GetHealthchecks

func (doc *Doctor) GetHealthchecks() *[]Healthcheck

GetHealthchecks returns a copy of list of healthchecks that the doctor is holding internally.

func (*Doctor) HasStatusBeenReported

func (doc *Doctor) HasStatusBeenReported() bool

HasStatusBeenReported returns whether we have already sent the current state of the healthchecks to the backend or not

func (*Doctor) RunHealthchecks

func (doc *Doctor) RunHealthchecks() bool

RunHealthchecks runs every healthcheck that the doctor knows about and returns a cumulative result; true if they all pass, false otherwise

func (*Doctor) SetStatusReported

func (doc *Doctor) SetStatusReported(statusReported bool)

SetStatusReported tells the doctor that we have already reported the current status of the healthchecks to the backend

type Healthcheck

type Healthcheck interface {
	GetHealthcheckType() string
	GetHealthcheckStatus() HealthcheckStatus
	GetHealthcheckTime() time.Time
	GetStatusChangeTime() time.Time
	GetLastHealthcheckStatus() HealthcheckStatus
	GetLastHealthcheckTime() time.Time
	RunCheck() HealthcheckStatus
	SetHealthcheckStatus(status HealthcheckStatus)
}

type HealthcheckStatus

type HealthcheckStatus int32

HealthcheckStatus is an enumeration of possible instance statuses

const (
	// HealthcheckStatusInitializing is the zero state of a healthcheck status
	HealthcheckStatusInitializing HealthcheckStatus = iota
	// HealthcheckStatusOk represents a healthcheck with a true/success result
	HealthcheckStatusOk
	// HealthcheckStatusImpaired represents a healthcheck with a false/fail result
	HealthcheckStatusImpaired
)

func (*HealthcheckStatus) MarshalJSON

func (hs *HealthcheckStatus) MarshalJSON() ([]byte, error)

MarshalJSON overrides the logic for JSON-encoding the HealthcheckStatus type

func (HealthcheckStatus) Ok

func (hs HealthcheckStatus) Ok() bool

Ok returns true if the Healthcheck status is OK or INITIALIZING

func (HealthcheckStatus) String

func (hs HealthcheckStatus) String() string

String returns a human readable string representation of this object

func (*HealthcheckStatus) UnmarshalJSON

func (hs *HealthcheckStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON overrides the logic for parsing the JSON-encoded HealthcheckStatus data

Jump to

Keyboard shortcuts

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