Documentation
¶
Index ¶
- Variables
- func DefaultSkipPaths() map[string]bool
- func HealthZHandler() http.Handler
- func RecordRoute(next http.Handler) http.Handler
- func RoutePattern(r *http.Request) string
- func ServiceHealthURL(base string) string
- func TrackRoute(next http.Handler) http.Handler
- type CheckFunc
- type MemoryState
- type MetricFunc
- type Metrics
- type MetricsOptions
- type ProbeOption
- type ProbeState
- type Prober
- func (p *Prober) AddHTTPProbe(id, url string, opts ...ProbeOption) error
- func (p *Prober) AddMetric(id string, fn MetricFunc)
- func (p *Prober) AddProbe(id string, check CheckFunc, opts ...ProbeOption) error
- func (p *Prober) AddServiceProbe(id, baseURL string, opts ...ProbeOption) error
- func (p *Prober) AddTCPProbe(id, addr string, opts ...ProbeOption) error
- func (p *Prober) HealthPHandler() http.Handler
- func (p *Prober) ReadinessHandler() http.Handler
- func (p *Prober) RunOnce(ctx context.Context)
- func (p *Prober) Start(ctx context.Context)
- func (p *Prober) State() State
- func (p *Prober) Status() Status
- func (p *Prober) Stop()
- type ProberOption
- type State
- type Status
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultHTTPClient = &http.Client{Timeout: 30 * time.Second}
View Source
var ErrDuplicateProbe = errors.New("probe already registered")
Functions ¶
func DefaultSkipPaths ¶
func HealthZHandler ¶
func RoutePattern ¶
func ServiceHealthURL ¶
Types ¶
type MemoryState ¶
type MetricFunc ¶
type MetricFunc func() any
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics(o MetricsOptions) *Metrics
func (*Metrics) Middleware ¶
func (*Metrics) MustRegister ¶
func (m *Metrics) MustRegister(cs ...prometheus.Collector)
func (*Metrics) Registry ¶
func (m *Metrics) Registry() *prometheus.Registry
func (*Metrics) StreamOpened ¶
type MetricsOptions ¶
type ProbeOption ¶
type ProbeOption func(*probe)
func Interval ¶
func Interval(d time.Duration) ProbeOption
func Optional ¶
func Optional() ProbeOption
func Timeout ¶
func Timeout(d time.Duration) ProbeOption
type ProbeState ¶
type Prober ¶
type Prober struct {
// contains filtered or unexported fields
}
func NewProber ¶
func NewProber(instance string, opts ...ProberOption) *Prober
func (*Prober) AddHTTPProbe ¶
func (p *Prober) AddHTTPProbe(id, url string, opts ...ProbeOption) error
func (*Prober) AddMetric ¶
func (p *Prober) AddMetric(id string, fn MetricFunc)
func (*Prober) AddProbe ¶
func (p *Prober) AddProbe(id string, check CheckFunc, opts ...ProbeOption) error
func (*Prober) AddServiceProbe ¶
func (p *Prober) AddServiceProbe(id, baseURL string, opts ...ProbeOption) error
func (*Prober) AddTCPProbe ¶
func (p *Prober) AddTCPProbe(id, addr string, opts ...ProbeOption) error
func (*Prober) HealthPHandler ¶
func (*Prober) ReadinessHandler ¶
type ProberOption ¶
type ProberOption func(*Prober)
func WithDefaultInterval ¶
func WithDefaultInterval(d time.Duration) ProberOption
func WithDefaultTimeout ¶
func WithDefaultTimeout(d time.Duration) ProberOption
func WithVersion ¶
func WithVersion(v string) ProberOption
func WithoutScheduling ¶
func WithoutScheduling() ProberOption
type State ¶
type State struct {
Status Status `json:"status"`
Instance string `json:"instance"`
Version string `json:"version,omitempty"`
StartedAt time.Time `json:"startedAt"`
UptimeSec int64 `json:"uptimeSeconds"`
Goroutines int `json:"goroutines"`
Memory MemoryState `json:"memory"`
Probes map[string]ProbeState `json:"probes"`
Metrics map[string]any `json:"metrics,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.