histogram

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 7

Documentation

Overview

Package histogram provides an histogram interface and a Wavefront histogram implementation (https://docs.wavefront.com/proxies_histograms.html).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Centroid

type Centroid struct {
	Value float64
	Count int
}

Centroid encapsulates a mean value and the count of points associated with that value.

type Centroids added in v0.9.8

type Centroids []Centroid

func (Centroids) Compact added in v0.9.8

func (centroids Centroids) Compact() Centroids

type Distribution

type Distribution struct {
	Centroids []Centroid
	Timestamp time.Time
}

Distribution holds the samples and its timestamp.

type Granularity

type Granularity int8

Granularity is the interval (MINUTE, HOUR and/or DAY) by which the histogram data should be aggregated.

const (
	MINUTE Granularity = iota
	HOUR
	DAY
)

func (*Granularity) Duration

func (hg *Granularity) Duration() time.Duration

Duration of the Granularity

func (*Granularity) String

func (hg *Granularity) String() string

type Histogram

type Histogram interface {
	Update(v float64)
	Distributions() []Distribution
	Snapshot() []Distribution
	Count() uint64
	Quantile(q float64) float64
	Max() float64
	Min() float64
	Sum() float64
	Mean() float64
	Granularity() Granularity
}

Histogram a quantile approximation data structure

func New

func New(setters ...Option) Histogram

New creates a new Wavefront histogram

type Option

type Option func(*histogramImpl)

Option allows histogram customization

func Compression

func Compression(c float64) Option

Compression of the histogram

func GranularityOption

func GranularityOption(g Granularity) Option

GranularityOption of the histogram

func MaxBins

func MaxBins(c int) Option

MaxBins of the histogram

func TimeSupplier added in v0.9.7

func TimeSupplier(supplier func() time.Time) Option

TimeSupplier for the histogram time computations

Jump to

Keyboard shortcuts

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