influx_upstream

package
v1.23.4 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 8 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 {
	DefaultTags map[string]string
	// contains filtered or unexported fields
}

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

func NewParser

func NewParser() *Parser

NewParser returns a Parser than accepts line protocol

func NewSeriesParser

func NewSeriesParser() *Parser

NewSeriesParser returns a Parser than accepts a measurement and tagset

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)

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)

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