buffer

package
v0.0.0-...-3667945 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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