Documentation
¶
Index ¶
- Variables
- func FindFirst[T any](node any) *T
- type AggOperator
- type ByOrWithout
- type Comparison
- type Drop
- type DropParam
- type Head
- type LRAOrUnwrap
- type LabelFilter
- type LabelFormat
- type LabelFormatOp
- type LabelName
- type LineFilter
- type LineFormat
- type LogQLScript
- type MacrosOp
- type Offset
- type Parser
- type ParserParam
- type QuantileOverTime
- type QuotedString
- type SimpleLabelFilter
- type StrSelCmd
- type StrSelector
- type StrSelectorPipeline
- type TopK
- type Unwrap
Constants ¶
This section is empty.
Variables ¶
View Source
var LogQLLexerDefinition = lexer.MustSimple(LogQLLexerRulesV2)
View Source
var LogQLLexerRulesV2 = []lexer.SimpleRule{
{Name: "Ocb", Pattern: `\{`},
{Name: "Ccb", Pattern: `\}`},
{Name: "Ob", Pattern: `\(`},
{Name: "Cb", Pattern: `\)`},
{Name: "Osb", Pattern: `\[`},
{Name: "Csb", Pattern: `\]`},
{Name: "Ge", Pattern: `>=`},
{Name: "Le", Pattern: `<=`},
{Name: "Gt", Pattern: `>`},
{Name: "Lt", Pattern: `<`},
{Name: "Deq", Pattern: `==`},
{Name: "Comma", Pattern: `,`},
{Name: "Neq", Pattern: `!=`},
{Name: "Re", Pattern: `=~`},
{Name: "Nre", Pattern: `!~`},
{Name: "Eq", Pattern: `=`},
{Name: "PipeLineFilter", Pattern: `(\|=|\|~|\|>)`},
{Name: "Pipe", Pattern: `\|`},
{Name: "Dot", Pattern: `\.`},
{Name: "Macros_function", Pattern: `_[a-zA-Z0-9_]+`},
{Name: "Label_name", Pattern: `[a-zA-Z_][a-zA-Z0-9_]*`},
{Name: "Quoted_string", Pattern: `"([^"\\]|\\.)*"`},
{Name: "Ticked_string", Pattern: "`([^`\\\\]|\\\\.)*`"},
{Name: "Integer", Pattern: "[0-9]+"},
{Name: "space", Pattern: `\s+`},
}
Functions ¶
Types ¶
type AggOperator ¶
type AggOperator struct {
Fn string `@("sum"|"min"|"max"|"avg"|"stddev"|"stdvar"|"count") `
ByOrWithoutPrefix *ByOrWithout `@@?`
LRAOrUnwrap LRAOrUnwrap `"(" @@ ")" `
ByOrWithoutSuffix *ByOrWithout `@@?`
Comparison *Comparison `@@?`
}
func (AggOperator) String ¶
func (l AggOperator) String() string
type ByOrWithout ¶
type ByOrWithout struct {
Fn string `@("by"|"without") `
Labels []LabelName `"(" @@ ("," @@)* ")" `
}
func (ByOrWithout) LabelNames ¶
func (l ByOrWithout) LabelNames() []string
func (ByOrWithout) String ¶
func (l ByOrWithout) String() string
type Comparison ¶
type Comparison struct {
Fn string `@("=="|"!="|">"|">="|"<"|"<=") `
Val string `@(Integer "."? Integer*)`
}
func (Comparison) String ¶
func (l Comparison) String() string
type DropParam ¶
type DropParam struct {
Label LabelName `@@`
Val *QuotedString `("=" @@)?`
}
type Head ¶
type Head struct {
ComplexHead *LabelFilter `"(" @@ ")"`
SimpleHead *SimpleLabelFilter `|@@`
}
type LRAOrUnwrap ¶
type LRAOrUnwrap struct {
Fn string `` /* 216-byte string literal not displayed */
ByOrWithoutPrefix *ByOrWithout `( @@)?`
StrSel StrSelector `"(" @@ `
Time string `"[" @Integer `
TimeUnit string `@("ns"|"us"|"ms"|"s"|"m"|"h") "]" `
Offset *Offset `("offset" @@)? ")" `
ByOrWithoutSuffix *ByOrWithout `@@?`
Comparison *Comparison `@@?`
}
func (LRAOrUnwrap) String ¶
func (l LRAOrUnwrap) String() string
type LabelFilter ¶
type LabelFilter struct {
Head Head `@@`
Op string `(@("and"|"or"))?`
Tail *LabelFilter `@@?`
}
func (*LabelFilter) String ¶
func (l *LabelFilter) String() string
type LabelFormat ¶
type LabelFormat struct {
LabelFormatOps []LabelFormatOp `"label_format" @@ ("," @@ )*`
}
func (*LabelFormat) String ¶
func (l *LabelFormat) String() string
type LabelFormatOp ¶
type LabelFormatOp struct {
Label LabelName `@@ "=" `
LabelVal *LabelName `(@@`
ConstVal *QuotedString `|@@)`
}
func (*LabelFormatOp) String ¶
func (l *LabelFormatOp) String() string
type LineFilter ¶
type LineFilter struct {
Fn string `@("|="|"!="|"|~"|"!~"|"|>")`
Val QuotedString `@@`
}
func (*LineFilter) String ¶
func (l *LineFilter) String() string
type LineFormat ¶
type LineFormat struct {
Val QuotedString `"line_format" @@ `
}
func (*LineFormat) String ¶
func (f *LineFormat) String() string
type LogQLScript ¶
type LogQLScript struct {
StrSelector *StrSelector `@@`
LRAOrUnwrap *LRAOrUnwrap `| @@`
AggOperator *AggOperator `| @@`
Macros *MacrosOp `| @@`
TopK *TopK `| @@`
QuantileOverTime *QuantileOverTime `| @@`
}
func Parse ¶
func Parse(str string) (*LogQLScript, error)
func ParseSeries ¶
func ParseSeries(str string) (*LogQLScript, error)
func (LogQLScript) String ¶
func (l LogQLScript) String() string
type MacrosOp ¶
type MacrosOp struct {
Name string `@Macros_function`
Params []QuotedString `"(" @@? ("," @@)* ")"`
}
type Parser ¶
type Parser struct {
Fn string `@("json"|"logfmt"|"regexp")`
ParserParams []ParserParam `@@? ("," @@)*`
}
type ParserParam ¶
type ParserParam struct {
Label *LabelName `(@@ "=" )?`
Val QuotedString `@@`
}
func (*ParserParam) String ¶
func (p *ParserParam) String() string
type QuantileOverTime ¶
type QuantileOverTime struct {
Fn string `@"quantile_over_time" `
ByOrWithoutPrefix *ByOrWithout `@@?`
Param string `"(" @(Integer+ "."? Integer*) "," `
StrSel StrSelector `@@`
Time string `"[" @Integer `
TimeUnit string `@("ns"|"us"|"ms"|"s"|"m"|"h") "]" ")" `
ByOrWithoutSuffix *ByOrWithout `@@?`
Comparison *Comparison `@@?`
}
func (QuantileOverTime) String ¶
func (l QuantileOverTime) String() string
type QuotedString ¶
type QuotedString struct {
Str string `@(Quoted_string|Ticked_string) `
}
func (QuotedString) String ¶
func (q QuotedString) String() string
func (*QuotedString) Unquote ¶
func (q *QuotedString) Unquote() (string, error)
type SimpleLabelFilter ¶
type SimpleLabelFilter struct {
Label LabelName `@@`
Fn string `@("="|"!="|"!~"|"=="|">="|">"|"<="|"<"|"=~")`
StrVal *QuotedString `(@@`
NumVal string `| @(Integer "."? Integer*))`
}
func (*SimpleLabelFilter) String ¶
func (s *SimpleLabelFilter) String() string
type StrSelCmd ¶
type StrSelCmd struct {
Label LabelName `@@`
Op string `@("="|"!="|"=~"|"!~")`
Val QuotedString `@@`
}
type StrSelector ¶
type StrSelector struct {
StrSelCmds []StrSelCmd `"{" @@? ("," @@ )* "}" `
Pipelines []StrSelectorPipeline `@@*`
}
func (StrSelector) String ¶
func (l StrSelector) String() string
type StrSelectorPipeline ¶
type StrSelectorPipeline struct {
LineFilter *LineFilter `@@ `
LabelFilter *LabelFilter `| "|" @@ `
Parser *Parser `| "|" @@ `
LineFormat *LineFormat `| "|" @@ `
LabelFormat *LabelFormat `| "|" @@ `
Unwrap *Unwrap `| "|" @@ `
Drop *Drop `| "|" @@ `
}
func (*StrSelectorPipeline) String ¶
func (s *StrSelectorPipeline) String() string
type TopK ¶
type TopK struct {
Fn string `@("topk"|"bottomk")`
Param string `"(" @(Integer+ "."? Integer*) "," `
LRAOrUnwrap *LRAOrUnwrap `(@@`
AggOperator *AggOperator `| @@`
QuantileOverTime *QuantileOverTime `| @@)")"`
Comparison *Comparison `@@?`
}
Click to show internal directories.
Click to hide internal directories.