Back to

package filtermetric

Latest Go to latest
Published: Jun 16, 2020 | License: Apache-2.0 | Module:


Package filtermetric is a helper package for processing metrics.


type MatchProperties

type MatchProperties struct {
	// MatchConfig configures the matching patterns used when matching metric properties.
	filterset.Config `mapstructure:",squash"`

	// 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"`

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

type Matcher

type Matcher struct {
	// contains filtered or unexported fields

Matcher matches metrics by metric properties against prespecified values for each property.

func NewMatcher

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

NewMatcher constructs a metric Matcher that can be used to match metrics by metric properties. For each supported metric property, the Matcher accepts a set of prespecified values. An incoming metric matches on a property if the property matches at least one of the prespecified values. A metric only matches if every metric property configured on the Matcher is a match.

The metric Matcher supports matching by the following metric properties: - Metric name

func (*Matcher) MatchMetric

func (m *Matcher) MatchMetric(metric *metricspb.Metric) bool

MatchMetric matches a metric using the metric properties configured on the Matcher. A metric only matches if every metric property configured on the Matcher is a match.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier