Back to godoc.org
go.opentelemetry.io/collector/internal/processor/filterset/regexp

package regexp

v0.4.0
Latest Go to latest
Published: Jun 16, 2020 | License: Apache-2.0 | Module: go.opentelemetry.io/collector

Overview

Package regexp provides an implementation to match strings against a set of regexp string filters.

Index

type Config

type Config struct {
	// CacheEnabled determines whether match results are LRU cached to make subsequent matches faster.
	// Cache size is unlimited unless CacheMaxNumEntries is also specified.
	CacheEnabled bool `mapstructure:"cacheenabled"`
	// CacheMaxNumEntries is the max number of entries of the LRU cache that stores match results.
	// CacheMaxNumEntries is ignored if CacheEnabled is false.
	CacheMaxNumEntries int `mapstructure:"cachemaxnumentries"`
}

RegexpConfig represents the options for a NewFilterSet.

type FilterSet

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

FilterSet encapsulates a set of filters and caches match results. Filters are re2 regex strings. FilterSet is exported for convenience, but has unexported fields and should be constructed through NewFilterSet.

FilterSet satisfies the FilterSet interface from "go.opentelemetry.io/collector/internal/processor/filterset"

func NewFilterSet

func NewFilterSet(filters []string, cfg *Config) (*FilterSet, error)

NewFilterSet constructs a FilterSet of re2 regex strings. If any of the given filters fail to compile into re2, an error is returned.

func (*FilterSet) Matches

func (rfs *FilterSet) Matches(toMatch string) bool

Matches returns true if the given string matches any of the FilterSet's filters. The given string must be fully matched by at least one filter's re2 regex.

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

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier