filter

package
v0.0.0-...-bd03ed3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package filter implements a message filter that may modify or block points.

Index

Constants

This section is empty.

Variables

View Source
var Debug *log.Logger

Functions

func Series

func Series(rules []Rule, in tsdb.Series) tsdb.Series

Series returns a filtered version of the given time series.

Types

type Filter

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

Filter filters time series data points.

func New

func New(rules ...Rule) (*Filter, error)

New creates a new Filter based on the given rules. An error is returned if the provided ruleset is invalid.

func (*Filter) Eval

func (f *Filter) Eval(point Point) (bool, error)

Eval evaluates the given point. It returns true if the point is accepted. The original point data may be lost due to calls to SetMetric and SetTags. If the original version is required, make a copy before calling Eval.

type Point

type Point interface {
	// Metric returns the current value of the Metric field.
	Metric() []byte

	// Tag returns the current value of the tag identified by the given key.
	// Tag returns nil if the tag is absent.
	Tag(key []byte) []byte

	// SetMetric sets the Metric field, expanding ${N} escapes.
	SetMetric([]byte) error

	// SetTags sets value of each tag identified by the provided key, value pairs.
	SetTags(keyval ...[]byte) error
}

Point represents a filterable data point.

type Rule

type Rule struct {
	Match []string `json:",omitempty"`
	Set   []string `json:",omitempty"`
	Block bool     `json:",omitempty"`
}

Rule represents configuration of a single rule.

func (Rule) String

func (r Rule) String() string

Jump to

Keyboard shortcuts

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