filtermetric

package
v0.0.0-...-719ad8f Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package filtermetric is a helper package for processing metrics.

Index

Constants

View Source
const (
	Regexp           = MatchType(filterset.Regexp)
	Strict           = MatchType(filterset.Strict)
	Expr   MatchType = "expr"
)

These are the MatchTypes that users can specify for filtering `pdata.Metric`s.

Variables

This section is empty.

Functions

func SkipMetric

func SkipMetric(include, exclude Matcher, metric pdata.Metric, logger *zap.Logger) bool

Filters have the ability to include and exclude metrics based on the metric's properties. The default is to not skip. If include is defined, the metric must match or it will be skipped. If include is not defined but exclude is, metric will be skipped if it matches exclude. Metric is included if neither specified.

Types

type MatchProperties

type MatchProperties struct {
	// MatchType specifies the type of matching desired
	MatchType MatchType `mapstructure:"match_type"`
	// RegexpConfig specifies options for the Regexp match type
	RegexpConfig *regexp.Config `mapstructure:"regexp"`

	// MetricNames specifies the list of string patterns to match metric names against.
	// A match occurs if the metric name matches at least one string pattern in this list.
	MetricNames []string `mapstructure:"metric_names"`

	// Expressions specifies the list of expr expressions to match metrics against.
	// A match occurs if any datapoint in a metric matches at least one expression in this list.
	Expressions []string `mapstructure:"expressions"`

	// ResourceAttributes defines a list of possible resource attributes to match metrics against.
	// A match occurs if any resource attribute matches all expressions in this given list.
	ResourceAttributes []filterconfig.Attribute `mapstructure:"resource_attributes"`
}

MatchProperties specifies the set of properties in a metric to match against and the type of string pattern matching to use.

func CreateMatchPropertiesFromDefault

func CreateMatchPropertiesFromDefault(properties *filterconfig.MatchProperties) *MatchProperties

func (*MatchProperties) ChecksMetrics

func (mp *MatchProperties) ChecksMetrics() bool

ChecksMetrics returns whether the check should iterate through all the metrics

func (*MatchProperties) ChecksResourceAtributes

func (mp *MatchProperties) ChecksResourceAtributes() bool

ChecksResourceAtributes returns whether or not it checks the resource_attributes

type MatchType

type MatchType string

MatchType specifies the strategy for matching against `pdata.Metric`s. This is distinct from filterset.MatchType which matches against metric (and tracing) names only. To support matching against metric names and `pdata.Metric`s, filtermetric.MatchType is effectively a superset of filterset.MatchType.

type Matcher

type Matcher interface {
	MatchMetric(metric pdata.Metric) (bool, error)
}

func NewMatcher

func NewMatcher(config *MatchProperties) (Matcher, error)

NewMatcher constructs a metric Matcher. If an 'expr' match type is specified, returns an expr matcher, otherwise a name matcher.

Jump to

Keyboard shortcuts

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