Documentation ¶
Index ¶
- Variables
- type ParseError
- type Parser
- func (p *Parser) Init() error
- func (p *Parser) Parse(input []byte) ([]telegraf.Metric, error)
- func (p *Parser) ParseLine(line string) (telegraf.Metric, error)
- func (p *Parser) SetDefaultTags(tags map[string]string)
- func (p *Parser) SetTimeFunc(f TimeFunc)
- func (p *Parser) SetTimePrecision(u time.Duration) error
- type StreamParser
- type TimeFunc
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) SetDefaultTags ¶
func (*Parser) SetTimeFunc ¶
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
Click to show internal directories.
Click to hide internal directories.