statsdaemon

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2017 License: Unlicense Imports: 16 Imported by: 1

README

Benchmark

$ go test -bench=Bench .
BenchmarkOneBigTimer-4            	       1	1390692436 ns/op
BenchmarkLotsOfTimers-4           	       1	1528838842 ns/op
BenchmarkParseLineCounter-4       	 1000000	      1401 ns/op
BenchmarkParseLineGauge-4         	 1000000	      1303 ns/op
BenchmarkParseLineTimer-4         	 1000000	      1373 ns/op
BenchmarkParseLineSet-4           	 1000000	      1256 ns/op
BenchmarkPacketHandlerCounter-4   	10000000	       137 ns/op
BenchmarkPacketHandlerGauge-4     	10000000	       145 ns/op
BenchmarkPacketHandlerTimer-4     	10000000	       183 ns/op
BenchmarkPacketHandlerSet-4       	10000000	       197 ns/op
PASS
ok  	github.com/ChristianKniep/statsdaemon/lib	17.375s

Testcases

$ go test -cover .
ok  	github.com/ChristianKniep/statsdaemon/lib	0.011s	coverage: 67.2% of statements 

Documentation

Index

Constants

View Source
const (
	MAX_UNPROCESSED_PACKETS = 1000
	TCP_READ_SIZE           = 4096
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Float64Slice

type Float64Slice []float64

func (Float64Slice) Len

func (s Float64Slice) Len() int

func (Float64Slice) Less

func (s Float64Slice) Less(i, j int) bool

func (Float64Slice) Swap

func (s Float64Slice) Swap(i, j int)

type MsgParser

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

func NewParser

func NewParser(reader io.Reader, partialReads, debug bool, maxUdpPacketSize int, prefix, postfix string) *MsgParser

func (*MsgParser) Next

func (mp *MsgParser) Next() (*Packet, bool)

type Packet

type Packet struct {
	Bucket   string
	ValFlt   float64
	ValStr   string
	Modifier string
	Sampling float32
}

type Percentile

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

func (*Percentile) String

func (p *Percentile) String() string

type Percentiles

type Percentiles []*Percentile

func (*Percentiles) Set

func (a *Percentiles) Set(s string) error

func (*Percentiles) String

func (a *Percentiles) String() string

type StatsDaemon

type StatsDaemon struct {
	Name            string
	Parser          MsgParser
	Signalchan      chan os.Signal
	Cfg             *config.Config
	In              chan *Packet
	Counters        map[string]float64
	Gauges          map[string]float64
	Timers          map[string]Float64Slice
	CountInactivity map[string]int64
	Sets            map[string][]string
	ReceiveCounter  string
	QChan           qtypes.QChan
	Percentiles     Percentiles
}

func NewNamedStatsdaemon

func NewNamedStatsdaemon(name string, cfg *config.Config, qchan qtypes.QChan) StatsDaemon

func NewStatsdaemon

func NewStatsdaemon(cfg *config.Config) StatsDaemon

func (*StatsDaemon) Bool

func (sd *StatsDaemon) Bool(path string) bool

func (*StatsDaemon) BoolOr

func (sd *StatsDaemon) BoolOr(path string, alt bool) bool

func (*StatsDaemon) FanOutCounters

func (sd *StatsDaemon) FanOutCounters(now time.Time) int64

func (*StatsDaemon) FanOutGauges

func (sd *StatsDaemon) FanOutGauges(now time.Time) int64

func (*StatsDaemon) FanOutMetrics

func (sd *StatsDaemon) FanOutMetrics()

func (*StatsDaemon) FanOutSets

func (sd *StatsDaemon) FanOutSets(now time.Time) int64

func (*StatsDaemon) FanOutTimers

func (sd *StatsDaemon) FanOutTimers(now time.Time) int64

func (*StatsDaemon) Int

func (sd *StatsDaemon) Int(path string) int

func (*StatsDaemon) IntOr

func (sd *StatsDaemon) IntOr(path string, alt int) int

func (*StatsDaemon) Log

func (sd *StatsDaemon) Log(logLevel, msg string)

func (*StatsDaemon) LoopChannel

func (sd *StatsDaemon) LoopChannel()

func (*StatsDaemon) ParseLine

func (sd *StatsDaemon) ParseLine(msg string) (err error)

func (*StatsDaemon) ParseTo

func (sd *StatsDaemon) ParseTo(conn io.ReadCloser, partialReads bool)

func (*StatsDaemon) ProcessCounters

func (sd *StatsDaemon) ProcessCounters(buffer *bytes.Buffer, now int64) int64

func (*StatsDaemon) ProcessGauges

func (sd *StatsDaemon) ProcessGauges(buffer *bytes.Buffer, now int64) int64

func (*StatsDaemon) ProcessSets

func (sd *StatsDaemon) ProcessSets(buffer *bytes.Buffer, now int64) int64

func (*StatsDaemon) ProcessTimers

func (sd *StatsDaemon) ProcessTimers(buffer *bytes.Buffer, now int64) int64

func (*StatsDaemon) Run

func (sd *StatsDaemon) Run()

func (*StatsDaemon) String

func (sd *StatsDaemon) String(path string) string

func (*StatsDaemon) StringOr

func (sd *StatsDaemon) StringOr(path, alt string) string

type TimerResult

type TimerResult struct {
	TestsGot map[string]string
	TestsExp map[string]float64
}

func NewTimerResult

func NewTimerResult(exp map[string]float64) TimerResult

func (*TimerResult) Check

func (tr *TimerResult) Check() bool

func (*TimerResult) Input

func (tr *TimerResult) Input(name string, value float64)

func (*TimerResult) Result

func (tr *TimerResult) Result() string

Jump to

Keyboard shortcuts

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