emitter

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2017 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMetricBatchSize is default size of metrics batch size.
	DefaultMetricBatchSize = 2000

	// DefaultMetricBufferLimit is default number of metrics kept. It should be a multiple of batch size.
	DefaultMetricBufferLimit = 10000

	// FlushLoggingInitial XXX
	FlushLoggingInitial = 5

	// FlushLoggingPeriod XXX
	FlushLoggingPeriod = 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

Buffer is an object for storing metrics in a circular buffer.

func NewBuffer

func NewBuffer(size int) *Buffer

NewBuffer returns a Buffer

size is the maximum number of metrics that Buffer will cache. If Add is
called when the buffer is full, then the oldest metric(s) will be dropped.

func (*Buffer) Add

func (b *Buffer) Add(metrics ...metric.Metric)

Add adds metrics to the buffer.

func (*Buffer) Batch

func (b *Buffer) Batch(batchSize int) []metric.Metric

Batch returns a batch of metrics of size batchSize. the batch will be of maximum length batchSize. It can be less than batchSize, if the length of Buffer is less than batchSize.

func (*Buffer) Drops

func (b *Buffer) Drops() int

Drops returns the total number of dropped metrics that have occurred in this buffer since instantiation.

func (*Buffer) IsEmpty

func (b *Buffer) IsEmpty() bool

IsEmpty returns true if Buffer is empty.

func (*Buffer) Len

func (b *Buffer) Len() int

Len returns the current length of the buffer.

func (*Buffer) Total

func (b *Buffer) Total() int

Total returns the total number of metrics that have been added to this buffer.

type Emitter

type Emitter struct {
	Parent interface{}

	MetricBufferLimit int
	MetricBatchSize   int
	// contains filtered or unexported fields
}

Emitter contains the output configuration

func NewEmitter

func NewEmitter(name string) *Emitter

NewEmitter XXX

func (*Emitter) IsFirstRun

func (e *Emitter) IsFirstRun() bool

IsFirstRun XXX

func (*Emitter) Post

func (e *Emitter) Post(metrics []metric.Metric) error

Post XXX

func (*Emitter) Run

func (e *Emitter) Run(shutdown chan struct{}, metricC chan metric.Metric, interval time.Duration) error

Run monitors the metrics channel and emits on the flush interval

Jump to

Keyboard shortcuts

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