variant

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

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

Go to latest
Published: Mar 24, 2013 License: Apache-2.0 Imports: 6 Imported by: 0

README

A project which will, eventually, provide lots of useful expvar.Vars types.

Docs

To use:

go get github.com/brianm/variant

Documentation

Overview

Package variant provides some (well, at the time of this writing) useful implementations of the expvar.Var interface (which is just a Stringer).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleMovingStat

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

represents a size bounded simple moving average it is thread/goroutine safe

func NewSimpleMovingAverage

func NewSimpleMovingAverage(name string, size int) *SimpleMovingStat

Create a new simple moving average expvar.Var. It will be published under `name` and maintain `size` values for calculating the average.

An empty name will cause it to not be published

func NewSimpleMovingMedian

func NewSimpleMovingMedian(name string, size int) *SimpleMovingStat

Create a new simple moving median expvar.Var. It will be published under `name` and maintain `size` values for calculating the median.

An empty name will cause it to not be published

This is just a convenience helper for a SimpleMovingPercentile

func NewSimpleMovingPercentile

func NewSimpleMovingPercentile(name string, percentile float64, size int) *SimpleMovingStat

Create a new simple moving percentile expvar.Var. It will be published under `name` and maintain `size` values for calculating the percentile.

percentile must be between 0 and 1

An empty name will cause it to not be published

func (*SimpleMovingStat) String

func (s *SimpleMovingStat) String() string

display the value as a string

func (*SimpleMovingStat) Update

func (s *SimpleMovingStat) Update(val float64)

Append a new value to the stat

func (*SimpleMovingStat) Value

func (s *SimpleMovingStat) Value() float64

obtain the current value

Jump to

Keyboard shortcuts

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