Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tracker ¶
type Tracker[T comparable] struct { Now func() time.Time // contains filtered or unexported fields }
Tracker accumulates failure events for a given key and determines if the key is degraded. The key becomes degraded if it receives only failures over a configurable pending period. Once the success event is received, the key is no longer considered degraded, and the pending period is reset.
func NewTracker ¶
func NewTracker[T comparable](period time.Duration) *Tracker[T]
func (*Tracker[T]) DegradedCount ¶
func (*Tracker[T]) RecordFailure ¶
func (t *Tracker[T]) RecordFailure(key T)
func (*Tracker[T]) RecordSuccess ¶
func (t *Tracker[T]) RecordSuccess(key T)
Click to show internal directories.
Click to hide internal directories.