serializers

package
v1.10.4-cortex Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2019 License: MIT Imports: 10 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

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Dataformat can be one of the serializer types listed in NewSerializer.
	DataFormat string

	// Support tags in graphite protocol
	GraphiteTagSupport bool

	// Maximum line length in bytes; influx format only
	InfluxMaxLineBytes int

	// Sort field keys, set to true only when debugging as it less performant
	// than unsorted fields; influx format only
	InfluxSortFields bool

	// Support unsigned integer output; influx format only
	InfluxUintSupport bool

	// Prefix to add to all measurements, only supports Graphite
	Prefix string

	// Template for converting telegraf metrics into Graphite
	// only supports Graphite
	Template string

	// Timestamp units to use for JSON formatted output
	TimestampUnits time.Duration

	// Include HEC routing fields for splunkmetric output
	HecRouting bool

	// Point tags to use as the source name for Wavefront (if none found, host will be used).
	WavefrontSourceOverride []string

	// Use Strict rules to sanitize metric and tag names from invalid characters for Wavefront
	// When enabled forward slash (/) and comma (,) will be accepted
	WavefrontUseStrict bool
}

Config is a struct that covers the data types needed for all serializer types, and can be used to instantiate _any_ of the serializers.

type Serializer

type Serializer interface {
	// Serialize takes a single telegraf metric and turns it into a byte buffer.
	// separate metrics should be separated by a newline, and there should be
	// a newline at the end of the buffer.
	//
	// New plugins should use SerializeBatch instead to allow for non-line
	// delimited metrics.
	Serialize(metric telegraf.Metric) ([]byte, error)

	// SerializeBatch takes an array of telegraf metric and serializes it into
	// a byte buffer.  This method is not required to be suitable for use with
	// line oriented framing.
	SerializeBatch(metrics []telegraf.Metric) ([]byte, error)
}

Serializer is an interface defining functions that a serializer plugin must satisfy.

Implementations of this interface should be reentrant but are not required to be thread-safe.

func NewCarbon2Serializer

func NewCarbon2Serializer() (Serializer, error)

func NewGraphiteSerializer

func NewGraphiteSerializer(prefix, template string, tag_support bool) (Serializer, error)

func NewInfluxSerializer

func NewInfluxSerializer() (Serializer, error)

func NewInfluxSerializerConfig

func NewInfluxSerializerConfig(config *Config) (Serializer, error)

func NewJsonSerializer

func NewJsonSerializer(timestampUnits time.Duration) (Serializer, error)

func NewNowSerializer

func NewNowSerializer() (Serializer, error)

func NewSerializer

func NewSerializer(config *Config) (Serializer, error)

NewSerializer a Serializer interface based on the given config.

func NewSplunkmetricSerializer

func NewSplunkmetricSerializer(splunkmetric_hec_routing bool) (Serializer, error)

func NewWavefrontSerializer

func NewWavefrontSerializer(prefix string, useStrict bool, sourceOverride []string) (Serializer, error)

type SerializerOutput

type SerializerOutput interface {
	// SetSerializer sets the serializer function for the interface.
	SetSerializer(serializer Serializer)
}

SerializerOutput is an interface for output plugins that are able to serialize telegraf metrics into arbitrary data formats.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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