matcher

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: BSD-2-Clause-Views Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher

type Matcher struct {
	Prefix    string `json:"prefix,omitempty"`
	NotPrefix string `json:"notPrefix,omitempty"`
	Sub       string `json:"sub,omitempty"`
	NotSub    string `json:"notSub,omitempty"`
	Regex     string `json:"regex,omitempty"`
	NotRegex  string `json:"notRegex,omitempty"`
	// contains filtered or unexported fields
}

func New

func New(prefix, notPrefix, sub, notSub, regex, notRegex string) (Matcher, error)

func (*Matcher) Equals added in v1.2.1

func (m *Matcher) Equals(o Matcher) bool

func (*Matcher) Match

func (m *Matcher) Match(s []byte) bool

Match checks the given byte slice against all defined filter conditions

func (*Matcher) MatchRegexAndExpand added in v0.13.0

func (m *Matcher) MatchRegexAndExpand(key, template []byte) (string, bool)

MatchRegexAndExpand only matches the given key against the "regex" condition, if it matches then it applies the given template and returns the resulting string as the first return value. The second return value indicates whether the regex matches the given key.

func (*Matcher) PreMatch added in v0.13.0

func (m *Matcher) PreMatch(s []byte) bool

PreMatch only checks the conditions which can be evaluated very quickly, while ignoring the ones which are more expensive to evaluate. If it returns false then a metric can be discarded, if it returns true then Match() should be applied to it to know whether it matches all criterias.

func (*Matcher) String

func (m *Matcher) String() string

Jump to

Keyboard shortcuts

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