dpfilters

package
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterSet

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

FilterSet is a collection of datapont filters, any one of which must match for a datapoint to be matched.

func NewFilterSet

func NewFilterSet(excludes []MetricFilter, includes []MetricFilter) (*FilterSet, error)

func (*FilterSet) Matches

func (fs *FilterSet) Matches(dp *sfxpb.DataPoint) bool

Matches sends a datapoint through each of the filters in the set and returns true if at least one of them matches the datapoint.

type MetricFilter

type MetricFilter struct {
	// A single metric name to match against.
	MetricName string `mapstructure:"metric_name"`
	// A list of metric names to match against.
	MetricNames []string `mapstructure:"metric_names"`
	// A map of dimension key/values to match against. All key/values must
	// match a datapoint for it to be matched. The map values can be either
	// a single string or a list of strings.
	Dimensions map[string]any `mapstructure:"dimensions"`
}

type PropertyFilter added in v0.72.0

type PropertyFilter struct {
	// PropertyName is the (inverted) literal, regex, or globbed property name/key to not include in dimension updates
	PropertyName *StringFilter `mapstructure:"property_name"`
	// PropertyValue is the (inverted) literal or globbed property value to not include in dimension updates
	PropertyValue *StringFilter `mapstructure:"property_value"`
	// DimensionName is the (inverted) literal, regex, or globbed dimension name/key to not target for dimension updates.
	// If there are no sub-property filters for its enclosing entry, it will disable dimension updates
	// for this dimension name in total.
	DimensionName *StringFilter `mapstructure:"dimension_name"`
	// PropertyValue is the (inverted) literal, regex, or globbed dimension value to not target with a dimension update
	// If there are no sub-property filters for its enclosing entry, it will disable dimension updates
	// for this dimension value in total.
	DimensionValue *StringFilter `mapstructure:"dimension_value"`
}

PropertyFilter is a collection of *StringFilter items used in determining if a given property (name and value) should be included with a dimension update request. The default values for all fields is equivalent to the regex StringFilter `/^.*$/` to match with any potential value.

Examples: Don't send any dimension updates for `k8s.pod.uid` dimension: - dimension_name: "k8s.pod.uid" Don't send dimension updates for any dimension with a value of `some.value`: - dimension_value: "some.value" Don't send dimension updates including a `some.property` property for any dimension: - property_name: "some.property" Don't send dimension updates including a `some.property` property with a "some.value" value for any dimension

  • property_name: "some.property" property_value: "some.value"

type StringFilter

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

StringFilter will match if any one of the given strings is a match.

func NewStringFilter

func NewStringFilter(items []string) (*StringFilter, error)

NewStringFilter returns a filter that can match against the provided items.

func (*StringFilter) Matches

func (f *StringFilter) Matches(s string) bool

Matches if s is positively matched by the filter items OR if it is positively matched by a non-glob/regex pattern exactly and is negated as well. See the unit tests for examples.

func (*StringFilter) UnmarshalText added in v0.72.0

func (f *StringFilter) UnmarshalText(in []byte) error

Jump to

Keyboard shortcuts

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