influx

package
v0.0.0-...-0fce7b6 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: MIT Imports: 11 Imported by: 0

README

InfluxDB Line Protocol

There are no additional configuration options for InfluxDB line protocol. The metrics are parsed directly into Telegraf metrics.

Configuration
[[inputs.file]]
  files = ["example"]

  ## Data format to consume.
  ## Each data format has its own unique set of configuration options, read
  ## more about them here:
  ##   https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
  data_format = "influx"

Documentation

Index

Constants

View Source
const LineProtocol_en_align int = 715
View Source
const LineProtocol_en_discard_line int = 247
View Source
const LineProtocol_en_main int = 259
View Source
const LineProtocol_en_series int = 250
View Source
const LineProtocol_error int = 0
View Source
const LineProtocol_first_final int = 259
View Source
const LineProtocol_start int = 259

Variables

View Source
var (
	ErrNameParse      = errors.New("expected measurement name")
	ErrFieldParse     = errors.New("expected field")
	ErrTagParse       = errors.New("expected tag")
	ErrTimestampParse = errors.New("expected timestamp")
	ErrParse          = errors.New("parse error")
	EOF               = errors.New("EOF")
)
View Source
var (
	ErrNoMetric = errors.New("no metric in line")
)

Functions

func NewMachine

func NewMachine(handler Handler) *machine

func NewSeriesMachine

func NewSeriesMachine(handler Handler) *machine

Types

type Handler

type Handler interface {
	SetMeasurement(name []byte) error
	AddTag(key []byte, value []byte) error
	AddInt(key []byte, value []byte) error
	AddUint(key []byte, value []byte) error
	AddFloat(key []byte, value []byte) error
	AddString(key []byte, value []byte) error
	AddBool(key []byte, value []byte) error
	SetTimestamp(tm []byte) error
}

type MetricHandler

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

func NewMetricHandler

func NewMetricHandler() *MetricHandler

func (*MetricHandler) AddBool

func (h *MetricHandler) AddBool(key []byte, value []byte) error

func (*MetricHandler) AddFloat

func (h *MetricHandler) AddFloat(key []byte, value []byte) error

func (*MetricHandler) AddInt

func (h *MetricHandler) AddInt(key []byte, value []byte) error

func (*MetricHandler) AddString

func (h *MetricHandler) AddString(key []byte, value []byte) error

func (*MetricHandler) AddTag

func (h *MetricHandler) AddTag(key []byte, value []byte) error

func (*MetricHandler) AddUint

func (h *MetricHandler) AddUint(key []byte, value []byte) error

func (*MetricHandler) Metric

func (h *MetricHandler) Metric() (telegraf.Metric, error)

func (*MetricHandler) Reset

func (h *MetricHandler) Reset()

func (*MetricHandler) SetMeasurement

func (h *MetricHandler) SetMeasurement(name []byte) error

func (*MetricHandler) SetTimeFunc

func (h *MetricHandler) SetTimeFunc(f metric.TimeFunc)

func (*MetricHandler) SetTimePrecision

func (h *MetricHandler) SetTimePrecision(precision time.Duration)

func (*MetricHandler) SetTimestamp

func (h *MetricHandler) SetTimestamp(tm []byte) error

type ParseError

type ParseError struct {
	Offset     int
	LineOffset int
	LineNumber int
	Column     int
	// contains filtered or unexported fields
}

func (*ParseError) Error

func (e *ParseError) Error() string

type Parser

type Parser struct {
	DefaultTags map[string]string

	sync.Mutex
	// contains filtered or unexported fields
}

func NewParser

func NewParser(handler *MetricHandler) *Parser

NewParser returns a Parser than accepts line protocol

func NewSeriesParser

func NewSeriesParser(handler *MetricHandler) *Parser

NewSeriesParser returns a Parser than accepts a measurement and tagset

func (Parser) Column

func (m Parser) Column() int

Column returns the current column.

func (Parser) LineNumber

func (m Parser) LineNumber() int

LineNumber returns the current line number. Lines are counted based on the regular expression `\r?\n`.

func (Parser) LineOffset

func (m Parser) LineOffset() int

LineOffset returns the byte offset of the current line.

func (Parser) Next

func (m Parser) Next() error

Next parses the next metric line and returns nil if it was successfully processed. If the line contains a syntax error an error is returned, otherwise if the end of file is reached before finding a metric line then EOF is returned.

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) Position

func (m Parser) Position() int

Position returns the current byte offset into the data.

func (Parser) SetData

func (m Parser) SetData(data []byte)

func (*Parser) SetDefaultTags

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

Jump to

Keyboard shortcuts

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