stats

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//TypeKeyValue key value aggregator
	TypeKeyValue = "kv"
	//TypeGauage gauage aggregator
	TypeGauage = "g"
	//TypeTimer timer aggregator
	TypeTimer = "ms"
	//TypeCounter counter aggregator
	TypeCounter = "c"
	//TypeSet set aggregator
	TypeSet = "s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FlushHandler

type FlushHandler func(*Stats)

FlushHandler is a callback type for stats flush

type Stats

type Stats struct {
	Timestamp int64           `json:"timestamp"`
	Series    [][]interface{} `json:"series"`
}

Stats is the aggregated stats

func (*Stats) String

func (s *Stats) String() string

type Statsd

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

Statsd represents the statsd daemon

func NewStatsd

func NewStatsd(prefix string, flush time.Duration, onflush FlushHandler) *Statsd

NewStatsd creats a new statsd daemon

func (*Statsd) Counter

func (statsd *Statsd) Counter(key string, value string)

Counter increments value, resets on flush

func (*Statsd) Feed

func (statsd *Statsd) Feed(str string) error

Feed statsd with statsD message according to specs str is in format 'key:value|type[|@flag]'

func (*Statsd) Gauage

func (statsd *Statsd) Gauage(key string, value string)

Gauage value change value, keep last on flush

func (*Statsd) KeyValue

func (statsd *Statsd) KeyValue(key string, value string)

KeyValue updates value to last, reset on flus

func (*Statsd) Run

func (statsd *Statsd) Run()

Run starts the statsd routine

func (*Statsd) Set

func (statsd *Statsd) Set(key string, value string)

Set keeps the count of unique values.

func (*Statsd) Stop

func (statsd *Statsd) Stop()

Stop stops the stats rountine and force flushing

func (*Statsd) Timer

func (statsd *Statsd) Timer(key string, value string)

Timer calcluates mean, median on time

Jump to

Keyboard shortcuts

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