Versions in this module Expand all Collapse all v3 v3.0.0 Apr 8, 2024 Changes in this version + const ConvertBytes + const ConvertDuration + const ConvertFloat + const IPv4Charset + const IPv6Charset + const MaxInternedStrings + var EmptyLabelsResult = NewLabelsResult(labels.EmptyLabels().String(), labels.EmptyLabels().Hash(), ...) + var ErrIPFilterInvalidOperation = errors.New("ip: invalid operation") + var ErrIPFilterInvalidPattern = errors.New("ip: invalid pattern") + var ExistsFilter = existsFilter + var TrueFilter = trueFilter + func IsNoopPipeline(p Pipeline) bool + type AnalyzablePipeline interface + LabelsBuilder func() *BaseLabelsBuilder + Stages func() []Stage + type BaseLabelsBuilder struct + func NewBaseLabelsBuilder() *BaseLabelsBuilder + func NewBaseLabelsBuilderWithGrouping(groups []string, parserKeyHints ParserHint, without, noLabels bool) *BaseLabelsBuilder + func (b *BaseLabelsBuilder) ForLabels(lbs labels.Labels, hash uint64) *LabelsBuilder + func (b *BaseLabelsBuilder) ParserLabelHints() ParserHint + func (b *BaseLabelsBuilder) Reset() + func (h BaseLabelsBuilder) Hash(lbs labels.Labels) uint64 + type BinaryLabelFilter struct + And bool + Left LabelFilterer + Right LabelFilterer + func NewAndLabelFilter(left LabelFilterer, right LabelFilterer) *BinaryLabelFilter + func NewOrLabelFilter(left LabelFilterer, right LabelFilterer) *BinaryLabelFilter + func (b *BinaryLabelFilter) Process(ts int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (b *BinaryLabelFilter) RequiredLabelNames() []string + func (b *BinaryLabelFilter) String() string + type BytesLabelFilter struct + Name string + Type LabelFilterType + Value uint64 + func NewBytesLabelFilter(t LabelFilterType, name string, b uint64) *BytesLabelFilter + func (d *BytesLabelFilter) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (d *BytesLabelFilter) RequiredLabelNames() []string + func (d *BytesLabelFilter) String() string + type Checker interface + Test func(line []byte, caseInsensitive bool, equal bool) bool + TestRegex func(reg *regexp.Regexp) bool + type Decolorizer struct + func NewDecolorizer() (*Decolorizer, error) + func (Decolorizer) Process(_ int64, line []byte, _ *LabelsBuilder) ([]byte, bool) + func (Decolorizer) RequiredLabelNames() []string + type DropLabel struct + Matcher *labels.Matcher + Name string + func NewDropLabel(matcher *labels.Matcher, name string) DropLabel + type DropLabels struct + func NewDropLabels(dl []DropLabel) *DropLabels + func (dl *DropLabels) Process(_ int64, line []byte, lbls *LabelsBuilder) ([]byte, bool) + func (dl *DropLabels) RequiredLabelNames() []string + type DurationLabelFilter struct + Name string + Type LabelFilterType + Value time.Duration + func NewDurationLabelFilter(t LabelFilterType, name string, d time.Duration) *DurationLabelFilter + func (d *DurationLabelFilter) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (d *DurationLabelFilter) RequiredLabelNames() []string + func (d *DurationLabelFilter) String() string + type Filterer interface + Filter func(line []byte) bool + ToStage func() Stage + func ChainOrFilter(curr, new Filterer) Filterer + func NewAndFilters(filters []Filterer) Filterer + func NewFilter(match string, mt LineMatchType) (Filterer, error) + func NewLabelFilter(match string, mt labels.MatchType) (Filterer, error) + type FiltererFunc func(line []byte) bool + func (f FiltererFunc) Filter(line []byte) bool + type Hints struct + func NewParserHint(requiredLabelNames, groups []string, without, noLabels bool, ...) *Hints + func (p *Hints) AllRequiredExtracted() bool + func (p *Hints) NoLabels() bool + func (p *Hints) PreserveError() bool + func (p *Hints) RecordExtracted(key string) + func (p *Hints) Reset() + func (p *Hints) ShouldContinueParsingLine(labelName string, lbs *LabelsBuilder) bool + func (p *Hints) ShouldExtract(key string) bool + func (p *Hints) ShouldExtractPrefix(prefix string) bool + type IPLabelFilter struct + Label string + Pattern string + Ty LabelFilterType + func NewIPLabelFilter(pattern, label string, ty LabelFilterType) *IPLabelFilter + func (f *IPLabelFilter) PatternError() error + func (f *IPLabelFilter) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (f *IPLabelFilter) RequiredLabelNames() []string + func (f *IPLabelFilter) String() string + type IPLineFilter struct + func NewIPLineFilter(pattern string, ty LineMatchType) (*IPLineFilter, error) + func (f *IPLineFilter) Filter(line []byte) bool + func (f *IPLineFilter) Process(_ int64, line []byte, _ *LabelsBuilder) ([]byte, bool) + func (f *IPLineFilter) RequiredLabelNames() []string + func (f *IPLineFilter) ToStage() Stage + type IPMatchType int + type IPMatcher interface + type JSONExpressionParser struct + func NewJSONExpressionParser(expressions []LabelExtractionExpr) (*JSONExpressionParser, error) + func (j *JSONExpressionParser) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (j *JSONExpressionParser) RequiredLabelNames() []string + type JSONParser struct + func NewJSONParser() *JSONParser + func (j *JSONParser) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (j *JSONParser) RequiredLabelNames() []string + type KeepLabel struct + Matcher *labels.Matcher + Name string + func NewKeepLabel(matcher *labels.Matcher, name string) KeepLabel + type KeepLabels struct + func NewKeepLabels(kl []KeepLabel) *KeepLabels + func (kl *KeepLabels) Process(_ int64, line []byte, lbls *LabelsBuilder) ([]byte, bool) + func (kl *KeepLabels) RequiredLabelNames() []string + type LabelCategory int + const InvalidCategory + const ParsedLabel + const StreamLabel + const StructuredMetadataLabel + type LabelExtractionExpr struct + Expression string + Identifier string + func NewLabelExtractionExpr(identifier, expression string) LabelExtractionExpr + type LabelFilterType int + const LabelFilterEqual + const LabelFilterGreaterThan + const LabelFilterGreaterThanOrEqual + const LabelFilterLesserThan + const LabelFilterLesserThanOrEqual + const LabelFilterNotEqual + func (f LabelFilterType) String() string + type LabelFilterer interface + func NewStringLabelFilter(m *labels.Matcher) LabelFilterer + func ReduceAndLabelFilter(filters []LabelFilterer) LabelFilterer + type LabelFmt struct + Name string + Rename bool + Value string + func NewRenameLabelFmt(dst, target string) LabelFmt + func NewTemplateLabelFmt(dst, template string) LabelFmt + type LabelsBuilder struct + func (b *LabelsBuilder) Add(category LabelCategory, labels ...labels.Label) *LabelsBuilder + func (b *LabelsBuilder) BaseHas(key string) bool + func (b *LabelsBuilder) Del(ns ...string) *LabelsBuilder + func (b *LabelsBuilder) Get(key string) (string, bool) + func (b *LabelsBuilder) GetErr() string + func (b *LabelsBuilder) GetErrorDetails() string + func (b *LabelsBuilder) GetWithCategory(key string) (string, LabelCategory, bool) + func (b *LabelsBuilder) GroupedLabels() LabelsResult + func (b *LabelsBuilder) HasErr() bool + func (b *LabelsBuilder) HasErrorDetails() bool + func (b *LabelsBuilder) IntoMap(m map[string]string) + func (b *LabelsBuilder) LabelsResult() LabelsResult + func (b *LabelsBuilder) Map() (map[string]string, bool) + func (b *LabelsBuilder) ResetError() *LabelsBuilder + func (b *LabelsBuilder) ResetErrorDetails() *LabelsBuilder + func (b *LabelsBuilder) Set(category LabelCategory, n, v string) *LabelsBuilder + func (b *LabelsBuilder) SetErr(err string) *LabelsBuilder + func (b *LabelsBuilder) SetErrorDetails(desc string) *LabelsBuilder + func (b *LabelsBuilder) UnsortedLabels(buf labels.Labels, categories ...LabelCategory) labels.Labels + func (h LabelsBuilder) Hash(lbs labels.Labels) uint64 + type LabelsFormatter struct + func NewLabelsFormatter(fmts []LabelFmt) (*LabelsFormatter, error) + func (lf *LabelsFormatter) Process(ts int64, l []byte, lbs *LabelsBuilder) ([]byte, bool) + func (lf *LabelsFormatter) RequiredLabelNames() []string + type LabelsResult interface + Hash func() uint64 + Labels func() labels.Labels + Parsed func() labels.Labels + Stream func() labels.Labels + String func() string + StructuredMetadata func() labels.Labels + func NewLabelsResult(allLabelsStr string, hash uint64, ...) LabelsResult + type LineExtractor func([]byte) float64 + var BytesExtractor LineExtractor = func(line []byte) float64 { ... } + var CountExtractor LineExtractor = func(line []byte) float64 { ... } + type LineFilterLabelFilter struct + Filter Filterer + func (s *LineFilterLabelFilter) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (s *LineFilterLabelFilter) RequiredLabelNames() []string + func (s *LineFilterLabelFilter) String() string + type LineFormatter struct + func NewFormatter(tmpl string) (*LineFormatter, error) + func (lf *LineFormatter) Process(ts int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (lf *LineFormatter) RequiredLabelNames() []string + type LineMatchType int + const LineMatchEqual + const LineMatchNotEqual + const LineMatchNotPattern + const LineMatchNotRegexp + const LineMatchPattern + const LineMatchRegexp + func (t LineMatchType) String() string + type LogfmtExpressionParser struct + func NewLogfmtExpressionParser(expressions []LabelExtractionExpr, strict bool) (*LogfmtExpressionParser, error) + func (l *LogfmtExpressionParser) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (l *LogfmtExpressionParser) RequiredLabelNames() []string + type LogfmtParser struct + func NewLogfmtParser(strict, keepEmpty bool) *LogfmtParser + func (l *LogfmtParser) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (l *LogfmtParser) RequiredLabelNames() []string + type Matcher interface + Matches func(test Checker) bool + type MatcherFilterer interface + func ChainOrMatcherFilterer(curr, new MatcherFilterer) MatcherFilterer + func NewAndFilter(left MatcherFilterer, right MatcherFilterer) MatcherFilterer + func NewNotFilter(base MatcherFilterer) MatcherFilterer + func WrapFilterer(f Filterer) MatcherFilterer + func WrapMatcher(m Matcher) MatcherFilterer + type NewMatcherFiltererFunc func(match []byte, caseInsensitive bool) MatcherFilterer + type NoopLabelFilter struct + func (NoopLabelFilter) Process(_ int64, line []byte, _ *LabelsBuilder) ([]byte, bool) + func (NoopLabelFilter) RequiredLabelNames() []string + func (f NoopLabelFilter) String() string + type NumericLabelFilter struct + Name string + Type LabelFilterType + Value float64 + func NewNumericLabelFilter(t LabelFilterType, name string, v float64) *NumericLabelFilter + func (n *NumericLabelFilter) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (n *NumericLabelFilter) RequiredLabelNames() []string + func (n *NumericLabelFilter) String() string + type ParserHint interface + AllRequiredExtracted func() bool + NoLabels func() bool + PreserveError func() bool + RecordExtracted func(string) + Reset func() + ShouldContinueParsingLine func(labelName string, lbs *LabelsBuilder) bool + ShouldExtract func(key string) bool + ShouldExtractPrefix func(prefix string) bool + func NoParserHints() ParserHint + type PatternParser struct + func NewPatternParser(pn string) (*PatternParser, error) + func (l *PatternParser) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (l *PatternParser) RequiredLabelNames() []string + type Pipeline interface + ForStream func(labels labels.Labels) StreamPipeline + Reset func() + func NewFilteringPipeline(f []PipelineFilter, p Pipeline) Pipeline + func NewNoopPipeline() Pipeline + func NewPipeline(stages []Stage) Pipeline + type PipelineFilter struct + End int64 + Matchers []*labels.Matcher + Pipeline Pipeline + Start int64 + type PipelineWrapper interface + Wrap func(ctx context.Context, pipeline Pipeline, query, tenant string) Pipeline + type RegexSimplifier struct + func NewRegexSimplifier(newContainsFilter NewMatcherFiltererFunc, ...) *RegexSimplifier + func (s *RegexSimplifier) Simplify(reg *syntax.Regexp, isLabel bool) (MatcherFilterer, bool) + type RegexpParser struct + func NewRegexpParser(re string) (*RegexpParser, error) + func (r *RegexpParser) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (r *RegexpParser) RequiredLabelNames() []string + type SampleExtractor interface + ForStream func(labels labels.Labels) StreamSampleExtractor + func LabelExtractorWithStages(labelName, conversion string, groups []string, without, noLabels bool, ...) (SampleExtractor, error) + func NewFilteringSampleExtractor(f []PipelineFilter, e SampleExtractor) SampleExtractor + func NewLineSampleExtractor(ex LineExtractor, stages []Stage, groups []string, without, noLabels bool) (SampleExtractor, error) + type SampleExtractorWrapper interface + Wrap func(ctx context.Context, extractor SampleExtractor, query, tenant string) SampleExtractor + type Simplifier interface + Simplify func(reg *syntax.Regexp, isLabel bool) (Filterer, bool) + type Stage interface + Process func(ts int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + RequiredLabelNames func() []string + var NoopStage Stage = &noopStage{} + func ReduceStages(stages []Stage) Stage + type StageFunc struct + func (fn StageFunc) Process(ts int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (fn StageFunc) RequiredLabelNames() []string + type StreamPipeline interface + BaseLabels func() LabelsResult + Process func(ts int64, line []byte, structuredMetadata ...labels.Label) (resultLine []byte, resultLabels LabelsResult, matches bool) + ProcessString func(ts int64, line string, structuredMetadata ...labels.Label) (resultLine string, resultLabels LabelsResult, matches bool) + ReferencedStructuredMetadata func() bool + func NewStreamPipeline(stages []Stage, labelsBuilder *LabelsBuilder) StreamPipeline + type StreamSampleExtractor interface + BaseLabels func() LabelsResult + Process func(ts int64, line []byte, structuredMetadata ...labels.Label) (float64, LabelsResult, bool) + ProcessString func(ts int64, line string, structuredMetadata ...labels.Label) (float64, LabelsResult, bool) + ReferencedStructuredMetadata func() bool + type StringLabelFilter struct + func (s *StringLabelFilter) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool) + func (s *StringLabelFilter) RequiredLabelNames() []string + type UnpackParser struct + func NewUnpackParser() *UnpackParser + func (UnpackParser) RequiredLabelNames() []string + func (u *UnpackParser) Process(_ int64, line []byte, lbs *LabelsBuilder) ([]byte, bool)