metrics

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Histogram

type Histogram struct {
	// contains filtered or unexported fields
}

func NewByteHistogram

func NewByteHistogram() Histogram

NewByteHistogram stringifies values using humanize over byte values

func NewTimeHistogram

func NewTimeHistogram() Histogram

func (*Histogram) Add

func (h *Histogram) Add(other *Histogram)

Add returns a new Histogram which is the result of adding this and other bucket-wise.

func (*Histogram) Clone

func (h *Histogram) Clone() *Histogram

func (Histogram) Mean

func (h Histogram) Mean() uint64

Mean returns 0 if there are no samples, and h.Sum()/h.Samples otherwise.

func (*Histogram) Sample

func (h *Histogram) Sample(v uint64)

Sample adds a uint64 data point to the histogram

func (*Histogram) SampleLen

func (h *Histogram) SampleLen(l int)

SampleLen is a convenience wrapper around Sample which internally type asserts the int to a uint64

func (*Histogram) SampleTimeSince

func (h *Histogram) SampleTimeSince(t time.Time)

SampleTimeSince is a convenience wrapper around Sample which takes the duration since |t|, if 0, rounds to 1 and passes to Sample() as an uint64 number of nanoseconds.

func (Histogram) Samples

func (h Histogram) Samples() uint64

Samples returns the number of samples contained in the histogram

func (Histogram) String

func (h Histogram) String() string

func (Histogram) Sum

func (h Histogram) Sum() uint64

Sum return the sum of sampled values, note that Sum can be overflowed without overflowing the histogram buckets.

type HistogramType

type HistogramType uint64
const (
	UnspecifiedHistogram HistogramType = iota
	TimeHistogram
	ByteHistogram
)

Jump to

Keyboard shortcuts

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