failurelag

package
v0.31.1-ecr-test Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

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]) Degraded

func (t *Tracker[T]) Degraded() []T

func (*Tracker[T]) DegradedCount

func (t *Tracker[T]) DegradedCount() int

func (*Tracker[T]) RecordFailure

func (t *Tracker[T]) RecordFailure(key T)

func (*Tracker[T]) RecordSuccess

func (t *Tracker[T]) RecordSuccess(key T)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL