Package filtermetric is a helper package for processing metrics.



    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.


      This section is empty.


      This section is empty.


      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 at least one expression 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.

        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.