golazy.dev
–
golazy.dev
/
lazycontrolplane
Index
|
Files
package lazycontrolplane
import "golazy.dev/lazycontrolplane"
Types
type Builder
Builder creates a control plane for lazyapp.
Config and *ControlPlane implement Builder. This keeps lazyapp.Config's ControlPlane field optional while still allowing ControlPlane: Config{}.
type Builder interface {
BuildControlPlane() *ControlPlane
}
type Config
Config describes the operational endpoints exposed by a control plane.
The zero Config exposes /livez and /readyz.
type Config struct {
Readiness []ReadinessCheck
Metrics http.Handler
Pprof bool
}
func (config Config) BuildControlPlane
BuildControlPlane implements Builder.
func (config Config) BuildControlPlane() *ControlPlane
type ControlPlane
ControlPlane routes operational endpoints.
type ControlPlane struct {
// contains filtered or unexported fields
}
func New
New builds a control plane from config.
func New(config Config) *ControlPlane
func (plane *ControlPlane) BuildControlPlane
BuildControlPlane implements Builder.
func (plane *ControlPlane) BuildControlPlane() *ControlPlane
func (plane *ControlPlane) Handler
Handler mounts the control plane in front of next.
func (plane *ControlPlane) Handler(next http.Handler) http.Handler
func (plane *ControlPlane) HandlesPath
HandlesPath reports whether path belongs to the control plane.
func (plane *ControlPlane) HandlesPath(path string) bool
func (plane *ControlPlane) ServeHTTP
ServeHTTP serves control-plane endpoints.
func (plane *ControlPlane) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ReadinessCheck
ReadinessCheck is evaluated by /readyz.
type ReadinessCheck struct {
Name string
Check func(context.Context) error
}
Package lazycontrolplane provides operational HTTP endpoints for GoLazy applications.
A control plane exposes framework-owned routes such as liveness and readiness probes outside the application's route table. The zero Config is useful: it creates a control plane with /livez and /readyz. Applications can pass Config to lazyapp.Config.ControlPlane to mount those endpoints with the app, or instantiate a ControlPlane directly when they want to serve it manually.