buffer

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MetricsWritten = selfstat.Register("agent", "metrics_written", map[string]string{})
	MetricsDropped = selfstat.Register("agent", "metrics_dropped", map[string]string{})
)

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 ...telegraf.Metric)

Add adds metrics to the buffer.

func (*Buffer) Batch

func (b *Buffer) Batch(batchSize int) []telegraf.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) 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.

Jump to

Keyboard shortcuts

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