Documentation ¶
Index ¶
Constants ¶
View Source
const ( OK = "OK" WARN = "WARN" CRIT = "CRIT" TypeInternal = "internal" TypeService = "service" TypeThirdParty = "third-party" )
Variables ¶
Functions ¶
func IsMoreCritical ¶ added in v1.2.1
IsMoreCritical checks if a's status level is more critical than b
Types ¶
type AdditionalHealthData ¶
type AdditionalHealthData struct { DependencyChecks []HealthChecker //The custom data can override the default health detail values DataProvider func(*gin.Context) map[string]interface{} //Description is set in server.RegisterDetailedHealth function, so there is no need //to set this field when initializing AdditionalHealthData struct Description string }
type AppInfo ¶
type AppInfo struct { Version string Revision string AppName string `env:"APPLICATION_NAME"` Hostname string `env:"HOSTNAME"` }
func (*AppInfo) FillFromENV ¶
FillFromENV will load pre-dfined values for env tags from environment variables
type DependencyInfo ¶
type DependencyState ¶
type Health ¶
type Health map[string]interface{}
*
// To make data for detailed health check: h := NewDetailedHealth(c, "some...") d := DependencyInfo{...} h.AddDependency(d) // Add as many dependencies as needed.
func NewDetailedHealth ¶
func NewDetailedHealth(ai *AppInfo, pi *ProjectInfo, description string) Health
NewDetailedHealth creates a health struct without any dependency.
func NewSimpleHealth ¶
NewSimpleHealth creates a health struct that can be rendered for the simple health check.
func (Health) AddDependency ¶
func (h Health) AddDependency(d *DependencyInfo)
func (Health) SetDependencies ¶
func (h Health) SetDependencies(d []DependencyInfo)
type HealthChecker ¶
type HealthChecker interface { Check() *DependencyInfo GetName() string GetType() string }
type ProjectInfo ¶
type ProjectInfo struct { Repo string `json:"repo" env:"PROJECT_REPO"` Home string `json:"home" env:"PROJECT_HOME"` Owners []string `json:"owners"` Logs []string `json:"logs"` Stats []string `json:"stats"` OwnersStr string `json:"-" env:"PROJECT_OWNERS"` LogsStr string `json:"-" env:"PROJECT_LOG_URLS"` StatsStr string `json:"-" env:"PROJECT_STATS_URLS"` }
func (*ProjectInfo) FillFromENV ¶
func (pi *ProjectInfo) FillFromENV() *ProjectInfo
FillFromENV will load pre-dfined values for env tags from environment variables
type WebCheck ¶
type WebCheck struct { Name string URL string Type string //ExpectedStatusCode should only be set when you expect a specific response code from //the health check. If it is set to a code > 0, when the response code is the same, //the dependency state status will be OK; otherwise it will be CRIT. I.e., if //you set it to 404, then when the response code is 404, the status will be OK. //This is mainly for checking some web server that does not implement a proper //health endpoint and you have to compromise the approach to check it. ExpectedStatusCode int }
func (WebCheck) Check ¶
func (wc WebCheck) Check() *DependencyInfo
Click to show internal directories.
Click to hide internal directories.