influx_upstream

package
v1.28.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 10 Imported by: 1

README

Influx Line Protocol

This package implements the upstream Influx line protocol parser. See the Influx README.md for more details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoMetric = errors.New("no metric in line")
	ErrEOF      = errors.New("EOF")
)

Functions

This section is empty.

Types

type ParseError

type ParseError struct {
	*lineprotocol.DecodeError
	// contains filtered or unexported fields
}

ParseError indicates a error in the parsing of the text.

func (*ParseError) Error

func (e *ParseError) Error() string

type Parser

type Parser struct {
	InfluxTimestampPrecsion config.Duration   `toml:"influx_timestamp_precision"`
	DefaultTags             map[string]string `toml:"-"`
	// If set to "series" a series machine will be initialized, defaults to regular machine
	Type string `toml:"-"`
	// contains filtered or unexported fields
}

Parser is an InfluxDB Line Protocol parser that implements the parsers.Parser interface.

func (*Parser) Init added in v1.24.0

func (p *Parser) Init() error

func (*Parser) Parse

func (p *Parser) Parse(input []byte) ([]telegraf.Metric, error)

func (*Parser) ParseLine

func (p *Parser) ParseLine(line string) (telegraf.Metric, error)

func (*Parser) SetDefaultTags

func (p *Parser) SetDefaultTags(tags map[string]string)

func (*Parser) SetTimeFunc

func (p *Parser) SetTimeFunc(f TimeFunc)

func (*Parser) SetTimePrecision

func (p *Parser) SetTimePrecision(u time.Duration) error

type StreamParser

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

StreamParser is an InfluxDB Line Protocol parser. It is not safe for concurrent use in multiple goroutines.

func NewStreamParser

func NewStreamParser(r io.Reader) *StreamParser

func (*StreamParser) Next

func (sp *StreamParser) Next() (telegraf.Metric, error)

Next parses the next item from the stream. You can repeat calls to this function if it returns ParseError to get the next metric or error.

func (*StreamParser) SetTimeFunc

func (sp *StreamParser) SetTimeFunc(f TimeFunc)

SetTimeFunc changes the function used to determine the time of metrics without a timestamp. The default TimeFunc is time.Now. Useful mostly for testing, or perhaps if you want all metrics to have the same timestamp.

func (*StreamParser) SetTimePrecision

func (sp *StreamParser) SetTimePrecision(u time.Duration) error

type TimeFunc

type TimeFunc func() time.Time

Jump to

Keyboard shortcuts

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