Help us shape the future of Go! Take the 2026 Go Developer Survey

graphite

package
v1.300053.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultSeparator is the default join character to use when joining multiple
	// measurment parts in a template.
	DefaultSeparator = "."
)

Variables

View Source
var (
	MinDate = time.Date(1901, 12, 13, 0, 0, 0, 0, time.UTC)
	MaxDate = time.Date(2038, 1, 19, 0, 0, 0, 0, time.UTC)
)

Minimum and maximum supported dates for timestamps.

Functions

func NewTemplate

func NewTemplate(pattern string, defaultTags map[string]string, separator string) (*template, error)

NewTemplate returns a new template ensuring it has a measurement specified.

Types

type Config

type Config struct {
	Separator string
	Templates []string
}

Config represents the configuration for Graphite endpoints.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the config's templates and tags.

type GraphiteParser

type GraphiteParser struct {
	Separator   string
	Templates   []string
	DefaultTags map[string]string
	// contains filtered or unexported fields
}

Parser encapsulates a Graphite Parser.

func NewGraphiteParser

func NewGraphiteParser(
	separator string,
	templates []string,
	defaultTags map[string]string,
) (*GraphiteParser, error)

func (*GraphiteParser) ApplyTemplate

func (p *GraphiteParser) ApplyTemplate(line string) (string, map[string]string, string, error)

ApplyTemplate extracts the template fields from the given line and returns the measurement name and tags.

func (*GraphiteParser) ApplyTemplateForMetricName

func (p *GraphiteParser) ApplyTemplateForMetricName(metricNameLine string) (string, map[string]string, string, error)

ApplyTempleteForMetricName extracts the template fields from the given metric name line and returns the measurement name and tags.

func (*GraphiteParser) Parse

func (p *GraphiteParser) Parse(buf []byte) ([]telegraf.Metric, error)

func (*GraphiteParser) ParseLine

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

Parse performs Graphite parsing of a single line.

func (*GraphiteParser) SetDefaultTags

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

type UnsupposedValueError

type UnsupposedValueError struct {
	Field string
	Value float64
}

An UnsupposedValueError is returned when a parsed value is not supposed.

func (*UnsupposedValueError) Error

func (err *UnsupposedValueError) Error() string

Jump to

Keyboard shortcuts

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