Documentation
¶
Overview ¶
Example ¶
package main import ( "github.com/goph/fxt" "github.com/goph/fxt/debug" "github.com/goph/healthz" "go.uber.org/fx" ) func main() { status := healthz.NewStatusChecker(healthz.Healthy) app := fx.New( fx.NopLogger, fxt.Bootstrap, fx.Provide( func() *debug.Config { return debug.NewConfig(":8080") }, debug.NewHealthCollector, debug.NewServer, ), fx.Invoke(func(collector healthz.Collector) { collector.RegisterChecker(healthz.ReadinessCheck, status) }), ) if err := app.Err(); err != nil { panic(err) } }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHealthCollector ¶
NewHealthCollector returns a new healthz.Collector.
func NewServer ¶
func NewServer(params ServerParams) (Handler, Err)
NewServer creates a new debug server.
func NewStatusChecker ¶ added in v0.6.1
func NewStatusChecker(collector healthz.Collector) *healthz.StatusChecker
NewStatusChecker returns a new healthz.StatusChecker with "Healthy" as the default value. It also registers the checker in the health collector.
Types ¶
type Err ¶ added in v0.2.0
type Err <-chan error
Err accepts an error which causes the application to stop.
type Handler ¶
type Handler interface { http.Handler // Handle registers the handler for the given pattern. // If a handler already exists for pattern, Handle panics. Handle(pattern string, handler http.Handler) // HandleFunc registers the handler function for the given pattern. HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) }
Handler accepts an http.Handler or http.HandlerFunc and registers it for a pattern.
Click to show internal directories.
Click to hide internal directories.