quantile

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SketchesApproxEqual

func SketchesApproxEqual(exp, act *Sketch, e float64) bool

SketchesApproxEqual checks whether two SketchSeries are equal

Types

type Agent

type Agent struct {
	Sketch   Sketch
	Buf      []Key
	CountBuf []KeyCount
}

An Agent sketch is an insert optimized version of the sketch for use in the datadog-agent.

func (*Agent) Finish

func (a *Agent) Finish() *Sketch

Finish flushes any pending inserts and returns a deep copy of the sketch.

func (*Agent) Insert

func (a *Agent) Insert(v float64, sampleRate float64)

Insert v into the sketch.

func (*Agent) InsertInterpolate

func (a *Agent) InsertInterpolate(lower float64, upper float64, count uint)

InsertInterpolate linearly interpolates a count from the given lower to upper bounds

func (*Agent) IsEmpty

func (a *Agent) IsEmpty() bool

IsEmpty returns true if the sketch is empty

func (*Agent) Reset

func (a *Agent) Reset()

Reset the agent sketch to the empty state.

type Config

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

A Config struct is passed around to many sketches (read-only).

func Default

func Default() *Config

Default returns the default config.

func NewConfig

func NewConfig(eps, min float64, binLimit int) (*Config, error)

NewConfig creates a config object with. TODO|DOC: describe params

func (*Config) MaxCount

func (c *Config) MaxCount() int

MaxCount returns the max number of values you can insert. This is limited by using a uint16 for bin.n

type Key

type Key int16

A Key represents a quantized version of a float64. See Config for more details

func InfKey

func InfKey(sign int) Key

InfKey returns the Key for +Inf if sign >= 0, -Inf if sign < 0.

func (Key) IsInf

func (k Key) IsInf() bool

IsInf returns true if the key represents +/-Inf

func (Key) String

func (k Key) String() string

type KeyCount

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

A KeyCount represents a Key and an associated count

type Sketch

type Sketch struct {
	Basic summary.Summary `json:"summary"`
	// contains filtered or unexported fields
}

A Sketch for tracking quantiles The serialized JSON of Sketch contains the summary only Bins are not included.

func (*Sketch) ApproxEquals

func (s *Sketch) ApproxEquals(o *Sketch, e float64) bool

ApproxEquals checks if s and o are equivalent, with e error allowed for Sum and Average

func (*Sketch) Cols

func (s *Sketch) Cols() (k []int32, n []uint32)

Cols returns an array of k and n.

func (*Sketch) Copy

func (s *Sketch) Copy() *Sketch

Copy returns a deep copy

func (*Sketch) CopyTo

func (s *Sketch) CopyTo(dst *Sketch)

CopyTo makes a deep copy of this sketch into dst.

func (*Sketch) Equals

func (s *Sketch) Equals(o *Sketch) bool

Equals returns true if s and o are equivalent.

func (*Sketch) GetRawBins

func (s *Sketch) GetRawBins() (int, string)

GetRawBins return raw bins information as string

func (*Sketch) Insert

func (s *Sketch) Insert(c *Config, vals ...float64)

Insert a single value into the sketch. NOTE: InsertMany is much more efficient.

func (*Sketch) InsertMany

func (s *Sketch) InsertMany(c *Config, values []float64)

InsertMany values into the sketch.

func (*Sketch) MemSize

func (s *Sketch) MemSize() (used, allocated int)

MemSize returns memory use in bytes:

used: uses len(bins)
allocated: uses cap(bins)

func (*Sketch) Merge

func (s *Sketch) Merge(c *Config, o *Sketch)

Merge o into s, without mutating o.

func (*Sketch) Quantile

func (s *Sketch) Quantile(c *Config, q float64) float64

Quantile returns v such that s.count*q items are <= v.

Special cases are:

	Quantile(c, q <= 0)  = min
 Quantile(c, q >= 1)  = max

func (*Sketch) Reset

func (s *Sketch) Reset()

Reset sketch to its empty state.

func (*Sketch) String

func (s *Sketch) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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