templating

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultSeparator is the default separation character to use when separating template parts.
	DefaultSeparator = "."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine uses a Matcher to retrieve the appropriate template and applies the template to the input string

func NewEngine

func NewEngine(joiner string, defaultTemplate *Template, templates []string) (*Engine, error)

NewEngine creates a new templating engine

func (*Engine) Apply

func (e *Engine) Apply(line string) (string, map[string]string, string, error)

Apply extracts the template fields from the given line and returns the measurement name, tags and field name

type Template

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

Template represents a pattern and tags to map a metric string to a influxdb Point

func NewDefaultTemplateWithPattern

func NewDefaultTemplateWithPattern(pattern string) (*Template, error)

func NewTemplate

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

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

func (*Template) Apply

func (t *Template) Apply(line string, joiner string) (string, map[string]string, string, error)

apply extracts the template fields from the given line and returns the measurement name, tags and field name

Jump to

Keyboard shortcuts

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