Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FxHealthCheckerModule = fx.Module( "health-checker", fx.Provide( NewDefaultHealthCheckerFactory, NewFxHealthChecker, ), )
Functions ¶
func AsHealthCheckerProbe ¶
Types ¶
type DefaultHealthCheckerFactory ¶
type DefaultHealthCheckerFactory struct{}
func (*DefaultHealthCheckerFactory) Create ¶
func (f *DefaultHealthCheckerFactory) Create(options ...HealthCheckerOption) (*HealthChecker, error)
type FxHealthCheckerParam ¶
type FxHealthCheckerParam struct { fx.In Factory HealthCheckerFactory Probes []HealthCheckerProbe `group:"health-checker-probes"` }
type HealthChecker ¶
type HealthChecker struct {
// contains filtered or unexported fields
}
func NewFxHealthChecker ¶
func NewFxHealthChecker(p FxHealthCheckerParam) (*HealthChecker, error)
func NewHealthChecker ¶
func NewHealthChecker() *HealthChecker
func (*HealthChecker) AddProbe ¶
func (c *HealthChecker) AddProbe(p HealthCheckerProbe) *HealthChecker
func (*HealthChecker) Run ¶
func (c *HealthChecker) Run(ctx context.Context) *HealthCheckerResult
type HealthCheckerFactory ¶
type HealthCheckerFactory interface {
Create(options ...HealthCheckerOption) (*HealthChecker, error)
}
func NewDefaultHealthCheckerFactory ¶
func NewDefaultHealthCheckerFactory() HealthCheckerFactory
type HealthCheckerOption ¶
type HealthCheckerOption func(o *options)
func WithProbes ¶
func WithProbes(p ...HealthCheckerProbe) HealthCheckerOption
type HealthCheckerProbe ¶
type HealthCheckerProbe interface { Name() string Check(ctx context.Context) *HealthCheckerProbeResult }
type HealthCheckerProbeResult ¶
type HealthCheckerProbeResult struct { Success bool `json:"success"` Message string `json:"message"` }
func NewHealthCheckerProbeResult ¶
func NewHealthCheckerProbeResult(success bool, message string) *HealthCheckerProbeResult
type HealthCheckerResult ¶
type HealthCheckerResult struct { Success bool `json:"success"` ProbesResults map[string]*HealthCheckerProbeResult `json:"probes"` }
Click to show internal directories.
Click to hide internal directories.