Documentation
¶
Index ¶
- type LabelFilter
- func IPLabelFilter(labelKey, cidr string) LabelFilter
- func MoreThanNumberLabelFilter(labelKey string, value string) LabelFilter
- func MultiValuesRegexFilter(labelKey string, values []string, not bool) (LabelFilter, bool)
- func NotIPLabelFilter(labelKey, cidr string) LabelFilter
- func NotStringLabelFilter(labelKey string, value string) LabelFilter
- func StringEqualLabelFilter(labelKey string, value string) LabelFilter
- func StringMatchLabelFilter(labelKey string, value string) LabelFilter
- func StringNotMatchLabelFilter(labelKey string, value string) LabelFilter
- type LineFilter
- func ArrayLineFilter(key string, values []string, not bool) LineFilter
- func ExactMatchLineFilter(key string, value string) LineFilter
- func NewEmptyLineFilter(key string, not, moreThan, allowEmpty bool) LineFilter
- func NotContainsKeyLineFilter(key string) LineFilter
- func NumericLineFilter(key string, values []string, not, moreThan bool) (LineFilter, bool)
- func RegexMatchLineFilter(key string, strictKey bool, value string) LineFilter
- func StringLineFilterCheckExact(key string, values []string, not bool) (LineFilter, bool)
- type Match
- type MultiQueries
- type SingleQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LabelFilter ¶
type LabelFilter struct {
// contains filtered or unexported fields
}
LabelFilter represents a condition based on a label name, value and matching operator. It applies to LogQL stream selectors and attribute filtering
func IPLabelFilter ¶
func IPLabelFilter(labelKey, cidr string) LabelFilter
func MoreThanNumberLabelFilter ¶
func MoreThanNumberLabelFilter(labelKey string, value string) LabelFilter
func MultiValuesRegexFilter ¶
func MultiValuesRegexFilter(labelKey string, values []string, not bool) (LabelFilter, bool)
func NotIPLabelFilter ¶
func NotIPLabelFilter(labelKey, cidr string) LabelFilter
func NotStringLabelFilter ¶
func NotStringLabelFilter(labelKey string, value string) LabelFilter
func StringEqualLabelFilter ¶
func StringEqualLabelFilter(labelKey string, value string) LabelFilter
func StringMatchLabelFilter ¶
func StringMatchLabelFilter(labelKey string, value string) LabelFilter
func StringNotMatchLabelFilter ¶
func StringNotMatchLabelFilter(labelKey string, value string) LabelFilter
func (*LabelFilter) WriteInto ¶
func (f *LabelFilter) WriteInto(sb *strings.Builder)
type LineFilter ¶
type LineFilter struct {
// contains filtered or unexported fields
}
LineFilter represents a condition based on a JSON raw text match.
func ArrayLineFilter ¶
func ArrayLineFilter(key string, values []string, not bool) LineFilter
func ExactMatchLineFilter ¶
func ExactMatchLineFilter(key string, value string) LineFilter
func NewEmptyLineFilter ¶
func NewEmptyLineFilter(key string, not, moreThan, allowEmpty bool) LineFilter
func NotContainsKeyLineFilter ¶
func NotContainsKeyLineFilter(key string) LineFilter
func NumericLineFilter ¶
func NumericLineFilter(key string, values []string, not, moreThan bool) (LineFilter, bool)
NumericLineFilter returns a LineFilter and true if it has an empty match
func RegexMatchLineFilter ¶
func RegexMatchLineFilter(key string, strictKey bool, value string) LineFilter
func StringLineFilterCheckExact ¶
func StringLineFilterCheckExact(key string, values []string, not bool) (LineFilter, bool)
StringLineFilterCheckExact returns a LineFilter and true if it has an empty match
func (*LineFilter) AsLabelFilters ¶
func (f *LineFilter) AsLabelFilters() []LabelFilter
AsLabelFilters transforms a LineFilter (raw text match) into a group of labelFilters (attributes match)
func (LineFilter) MatchFalse ¶
func (f LineFilter) MatchFalse() LineFilter
func (LineFilter) MatchTrue ¶
func (f LineFilter) MatchTrue() LineFilter
func (*LineFilter) WriteInto ¶
func (f *LineFilter) WriteInto(sb *strings.Builder)
WriteInto transforms a LineFilter to its corresponding part of a LogQL query under construction (contained in the provided strings.Builder)
type Match ¶
func NewMoreThanOrEqualMatch ¶ added in v0.1.11
func NewNotMatch ¶
func (*Match) ToLabelFilter ¶
func (m *Match) ToLabelFilter() (LabelFilter, bool)
type MultiQueries ¶
type MultiQueries []SingleQuery
MultiQueries is an union group of singleQueries (OR'ed)
func Parse ¶
func Parse(raw string) (MultiQueries, error)
Example of raw filters (url-encoded): foo=a,b&bar=c|baz=d Produces: [ [ ["foo", "a,b"], ["bar", "c"]], [["baz", "d"]]] ^ ^ ^ | | '--- Per-label OR: "foo" must have value "a" OR "b" | '----- In-group AND: "foo" must be "a" or "b" AND "bar" must be "c" '------- All groups OR: "foo" must be "a" or "b" AND "bar" must be "c", OR "baz" must be "d"
func (MultiQueries) Distribute ¶
func (m MultiQueries) Distribute(toDistribute []SingleQuery, ignorePred func(SingleQuery) bool) MultiQueries
Distribute allows to inject and "expand" queries with new filters. For example, say we have an initial query `q` with just "{{src-name=foo}}" and we want to enforce source OR dest namespace being "my-namespace". We'd write: `q.Distribute({{src-namespace="my-namespace"}, {dst-namespace="my-namespace"}})` Which results in: "{{src-namespace="my-namespace", src-name=foo}, {dst-namespace="my-namespace", src-name=foo}}"