Version: v0.7.0 Latest Latest

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

Go to latest
Published: Sep 19, 2016 License: MIT Imports: 1 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


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) Drops added in v0.7.0

func (b *Buffer) Drops() int

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

func (*Buffer) IsEmpty added in v0.7.0

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 added in v0.7.0

func (b *Buffer) Total() int

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

Source Files

Jump to

Keyboard shortcuts

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