rate

package module
v0.0.0-...-b14404a Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter struct {
	Now func() time.Time
	// contains filtered or unexported fields
}

func NewCounter

func NewCounter(window time.Duration) *Counter

func (*Counter) Get

func (r *Counter) Get() float64

func (*Counter) GetAt

func (r *Counter) GetAt(t time.Time) float64

func (*Counter) Inc

func (r *Counter) Inc(n float64) float64

type ErrorCounter

type ErrorCounter struct {
	Now func() time.Time
	// contains filtered or unexported fields
}

func NewErrorCounter

func NewErrorCounter(window time.Duration) *ErrorCounter

func (*ErrorCounter) Failure

func (e *ErrorCounter) Failure() float64

func (*ErrorCounter) MarkFailure

func (e *ErrorCounter) MarkFailure(n float64) float64

func (*ErrorCounter) MarkSuccess

func (e *ErrorCounter) MarkSuccess(n float64) float64

func (*ErrorCounter) Rate

func (e *ErrorCounter) Rate() float64

func (*ErrorCounter) Record

func (e *ErrorCounter) Record(fn func() error) error

func (*ErrorCounter) Success

func (e *ErrorCounter) Success() float64

Jump to

Keyboard shortcuts

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