Documentation
¶
Index ¶
- Constants
- Variables
- type Doctor
- func (doc *Doctor) AddHealthcheck(healthcheck Healthcheck)
- func (doc *Doctor) GetCluster() string
- func (doc *Doctor) GetContainerInstanceArn() string
- func (doc *Doctor) GetHealthchecks() *[]Healthcheck
- func (doc *Doctor) HasStatusBeenReported() bool
- func (doc *Doctor) RunHealthchecks() bool
- func (doc *Doctor) SetStatusReported(statusReported bool)
- type Healthcheck
- type HealthcheckStatus
Constants ¶
const ( HealthcheckTypeContainerRuntime = "ContainerRuntime" HealthcheckTypeAgent = "Agent" HealthcheckTypeEBSDaemon = "EBSDaemon" )
Variables ¶
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 ¶
GetCluster returns the cluster that was provided to the doctor while being initialized
func (*Doctor) GetContainerInstanceArn ¶
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 ¶
HasStatusBeenReported returns whether we have already sent the current state of the healthchecks to the backend or not
func (*Doctor) RunHealthchecks ¶
RunHealthchecks runs every healthcheck that the doctor knows about and returns a cumulative result; true if they all pass, false otherwise
func (*Doctor) SetStatusReported ¶
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