Documentation ¶
Index ¶
- type Check
- type CheckFunc
- type Config
- type Health
- func (h *Health) BulkRegister(c ...Config) (err error)
- func (h *Health) ExecuteCheck() Check
- func (h *Health) ExecuteStandalone()
- func (h *Health) Handler() http.Handler
- func (h *Health) HandlerFunc(w http.ResponseWriter, r *http.Request)
- func (h *Health) HealthCheckStandaloneMode(flagName string)
- func (h *Health) Register(c Config) error
- func (h *Health) Reset()
- type System
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check struct { // Status is the check status. Status string `json:"status"` // Timestamp is the time in which the check occurred. Timestamp time.Time `json:"timestamp"` // Failures holds the failed checks along with their messages. Failures map[string]string `json:"failures,omitempty"` // System holds information of the go process. System `json:"system"` }
Check represents the health check response.
type Config ¶
type Config struct { // Name is the name of the resource to be checked. Name string // Timeout is the timeout defined for every check. Timeout time.Duration // SkipOnErr if set to true, it will retrieve StatusOK providing the error message from the failed resource. SkipOnErr bool // Check is the func which executes the check. Check CheckFunc }
Config carries the parameters to run the check.
type Health ¶
type Health struct { //WithSysMetrics is the conditional to process system metrics //If it true log and response system metrics WithSysMetrics bool // ErrorLogFunc is the callback function for errors logging during check. // If not set logging is skipped. ErrorLogFunc func(err error, details string, extra ...interface{}) // DebugLogFunc is the callback function for debug logging during check. // If not set logging is skipped. DebugLogFunc func(...interface{}) // contains filtered or unexported fields }
func (*Health) BulkRegister ¶
Register allot of checks
func (*Health) ExecuteCheck ¶
Execute health check base on config map
func (*Health) ExecuteStandalone ¶
func (h *Health) ExecuteStandalone()
Execute health check in standalone which if it is not ok return code 1 to system
func (*Health) HandlerFunc ¶
func (h *Health) HandlerFunc(w http.ResponseWriter, r *http.Request)
HandlerFunc is the HTTP handler function.
func (*Health) HealthCheckStandaloneMode ¶
Execute a health check standalone if the flag chosen is true
type System ¶
type System struct { // Version is the go version. Version string `json:"version"` // GoroutinesCount is the number of the current goroutines. GoroutinesCount int `json:"goroutines_count"` // TotalAllocBytes is the total bytes allocated. TotalAllocBytes int `json:"total_alloc_bytes"` // HeapObjectsCount is the number of objects in the go heap. HeapObjectsCount int `json:"heap_objects_count"` // TotalAllocBytes is the bytes allocated and not yet freed. AllocBytes int `json:"alloc_bytes"` }
System runtime variables about the go process.
Click to show internal directories.
Click to hide internal directories.