Documentation
¶
Index ¶
- func InstallHealthGorillaMux(router *mux.Router)
- func InstallMetricsGorillaMux(router *mux.Router)
- func InstallMetricsRoutes(router *http.ServeMux) error
- func ListenAndServe(config *ServerConfig, handler http.Handler)
- type HealthTracker
- func (h *HealthTracker) GetAlive() bool
- func (h *HealthTracker) GetReady() bool
- func (h *HealthTracker) HandleHealthy(w http.ResponseWriter, r *http.Request)
- func (h *HealthTracker) HandleLiveness(w http.ResponseWriter, r *http.Request)
- func (h *HealthTracker) HandleReadiness(w http.ResponseWriter, r *http.Request)
- func (h *HealthTracker) IsInit() bool
- func (h *HealthTracker) LogStatusMsg(msg string)
- func (h *HealthTracker) SetAlive(alive bool) error
- func (h *HealthTracker) SetReady(ready bool) error
- type ServerConfig
- type TimeoutConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
func ListenAndServe(config *ServerConfig, handler http.Handler)
Types ¶
type HealthTracker ¶
func GetHealthTracker ¶
func GetHealthTracker() (*HealthTracker, error)
func InstallHealthRoutes ¶
func InstallHealthRoutes(router *http.ServeMux) (*HealthTracker, error)
func (*HealthTracker) GetAlive ¶
func (h *HealthTracker) GetAlive() bool
func (*HealthTracker) GetReady ¶
func (h *HealthTracker) GetReady() bool
func (*HealthTracker) HandleHealthy ¶
func (h *HealthTracker) HandleHealthy(w http.ResponseWriter, r *http.Request)
func (*HealthTracker) HandleLiveness ¶
func (h *HealthTracker) HandleLiveness(w http.ResponseWriter, r *http.Request)
func (*HealthTracker) HandleReadiness ¶
func (h *HealthTracker) HandleReadiness(w http.ResponseWriter, r *http.Request)
func (*HealthTracker) IsInit ¶
func (h *HealthTracker) IsInit() bool
func (*HealthTracker) LogStatusMsg ¶
func (h *HealthTracker) LogStatusMsg(msg string)
func (*HealthTracker) SetAlive ¶
func (h *HealthTracker) SetAlive(alive bool) error
func (*HealthTracker) SetReady ¶
func (h *HealthTracker) SetReady(ready bool) error
type ServerConfig ¶
type ServerConfig struct {
// Host is the local machine IP Address to bind the HTTP Server to
Host string `yaml:"host"`
// Port is the local machine TCP Port to bind the HTTP Server to
Port string `yaml:"port"`
Timeout TimeoutConfig `yaml:"timeout"`
}
func NewServerConfigDefault ¶
func NewServerConfigDefault() ServerConfig
func RegisterFlagsConfig ¶
func RegisterFlagsConfig(prefix string) *ServerConfig
type TimeoutConfig ¶
type TimeoutConfig struct {
// Readiness drain timeout
Drain time.Duration `yaml:"drain"`
// Server is the general server timeout to use
// for graceful shutdowns
Server time.Duration `yaml:"server"`
// Write is the amount of time to wait until an HTTP server
// write opperation is cancelled
Write time.Duration `yaml:"write"`
// Read is the amount of time to wait until an HTTP server
// read operation is cancelled
Read time.Duration `yaml:"read"`
// Read is the amount of time to wait
// until an IDLE HTTP session is closed
Idle time.Duration `yaml:"idle"`
}
func NewTimeoutConfigDefault ¶
func NewTimeoutConfigDefault() TimeoutConfig
Source Files
¶
- config.go
- health.go
- logging.go
- metrics.go
- server.go
Click to show internal directories.
Click to hide internal directories.