Documentation ¶
Index ¶
- Variables
- func CheckIsRunning() error
- func GetGlobalStatus() string
- func GetHealthcheckOutput(url string) (string, error)
- func GetStatusConfig() corecfg.StatusConfig
- func QueryForStatus(port int) (statusOut string)
- func RegisterHealthcheck(name, endpoint string, check CheckStatus) (string, error)
- func SetNameAndVersion(name, version string)
- func SetStatusConfig(statusCfg corecfg.StatusConfig)
- func StartPeriodicHealthCheck()
- type CheckStatus
- type GetStatusLevel
- type RegisterHealth
- type Server
- type Status
- type StatusLevel
Constants ¶
This section is empty.
Variables ¶
var (
ErrAlreadyRunning = errors.New(1613, "terminating agent, another instance of agent already running")
)
Healthcheck errors
Functions ¶
func CheckIsRunning ¶
func CheckIsRunning() error
CheckIsRunning - Checks if another instance is already running by looking at the healthcheck.
func GetGlobalStatus ¶
func GetGlobalStatus() string
GetGlobalStatus - return the status of the global health checker
func GetHealthcheckOutput ¶
GetHealthcheckOutput - query the http endpoint and return the body
func GetStatusConfig ¶
func GetStatusConfig() corecfg.StatusConfig
GetStatusConfig - Set the status config globally
func QueryForStatus ¶
QueryForStatus - create a URL string and call teh GetHealthcheckOutput func
func RegisterHealthcheck ¶
func RegisterHealthcheck(name, endpoint string, check CheckStatus) (string, error)
RegisterHealthcheck - register a new dependency with this service
func SetNameAndVersion ¶
func SetNameAndVersion(name, version string)
SetNameAndVersion - sets the name and version of the globalHealthChecker
func SetStatusConfig ¶
func SetStatusConfig(statusCfg corecfg.StatusConfig)
SetStatusConfig - Set the status config globally.
func StartPeriodicHealthCheck ¶
func StartPeriodicHealthCheck()
StartPeriodicHealthCheck - starts a job that runs the periodic health checks
Types ¶
type CheckStatus ¶
CheckStatus - the format expected for the method to get the Healthcheck status
type GetStatusLevel ¶
type GetStatusLevel func(endpoint string) StatusLevel
GetStatusLevel format for the function to get the StatusLevel of an endpoint
type RegisterHealth ¶
type RegisterHealth func(name, endpoint string, check CheckStatus) (string, error)
RegisterHealth is for registering a healthcheck function
type Server ¶
type Server struct { }
Server contains an http server for health checks.
func (*Server) HandleRequests ¶
func (s *Server) HandleRequests()
HandleRequests - starts the http server
type Status ¶
type Status struct { Result StatusLevel `json:"result"` Details string `json:"details,omitempty"` }
Status - the status of this healthcheck
type StatusLevel ¶
type StatusLevel string
StatusLevel - the level of the status of the healthcheck
const ( // OK - healthcheck is running properly OK StatusLevel = "OK" // FAIL - healthcheck is failing FAIL StatusLevel = "FAIL" )
func GetStatus ¶
func GetStatus(endpoint string) StatusLevel
GetStatus - returns the current status for specified service