Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TraceQLLexerDefinition = lexer.MustSimple(TraceQLLexerRulesV2)
View Source
var TraceQLLexerRulesV2 = []lexer.SimpleRule{
{"Ocb", `\{`},
{"Ccb", `\}`},
{"Ob", `\(`},
{"Cb", `\)`},
{"Comma", `,`},
{"Ge", `>=`},
{"Le", `<=`},
{"Ancestor", `<<&`},
{"NotAncestor", `<<~`},
{"Gt", `>`},
{"Lt", `<`},
{"NotDescendant", `!>>`},
{"Neq", `!=`},
{"Re", `=~`},
{"Nre", `!~`},
{"Eq", `=`},
{"Descendant", `&>>`},
{"Sibling", `~`},
{"Label_name", `(\.[a-zA-Z_][.:a-zA-Z0-9_-]*|[a-zA-Z_][.:a-zA-Z0-9_-]*)`},
{"Dot", `\.`},
{"And", `&&`},
{"Or", `\|\|`},
{"Pipe", `\|`},
{"Quoted_string", `"([^"\\]|\\.)*"`},
{"Ticked_string", "`([^`\\\\]|\\\\.)*`"},
{"Minus", "-"},
{"Float", `[0-9]+\.[0-9]+`},
{"Integer", "[0-9]+"},
{"space", `\s+`},
}
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator struct {
Fn string `"|" @("count"|"sum"|"min"|"max"|"avg")`
Attr string `"(" @Label_name? ")"`
Cmp string `@("="|"!="|"<"|"<="|">"|">=")`
Num string `@Minus? (@Float | @Integer @Dot? @Integer?)`
Measurement string `@("ns"|"us"|"ms"|"s"|"m"|"h"|"d")?`
}
func (Aggregator) String ¶
func (a Aggregator) String() string
type AttrSelector ¶
type AttrSelector struct {
Label string `@Label_name`
Op string `@("="|"!="|"<"|"<="|">"|">="|"=~"|"!~")?`
Val Value `@@?`
}
func (AttrSelector) String ¶
func (a AttrSelector) String() string
type AttrSelectorExp ¶
type AttrSelectorExp struct {
Head *AttrSelector `(@@`
BoolLiteral string `| @("true"|"false")`
ComplexHead *AttrSelectorExp `| "(" @@ ")" )`
AndOr string `@(And|Or)?`
Tail *AttrSelectorExp `@@?`
}
func (AttrSelectorExp) String ¶
func (a AttrSelectorExp) String() string
type ByClause ¶ added in v4.2.0
type ByClause struct {
Labels []string `"by" "(" @Label_name ( "," @Label_name )* ")"`
}
ByClause represents: by (label1, label2, ...)
type CompareSelector ¶ added in v4.2.0
type CompareSelector struct {
AttrSelector *AttrSelectorExp `"{" @@? "}"`
Comma *struct{} `","?`
Count int `@Integer?`
BaselineFrom *int64 `("," @Integer)?`
BaselineTo *int64 `("," @Integer)?`
}
CompareSelector handles the arguments to compare():
compare({selector}, N)
compare({selector}, N, baselineStartNs, baselineEndNs)
func (CompareSelector) String ¶ added in v4.2.0
func (c CompareSelector) String() string
type MetricsPipelineStage ¶ added in v4.2.0
type MetricsPipelineStage struct {
Fn string `"|" @Label_name`
Attr string `"(" @Label_name?`
Percentile *float64 `( "," @Float )?`
CompSel *CompareSelector `@@?`
Cb string `")"`
By *ByClause `@@?`
}
MetricsPipelineStage represents: | rate(), | count_over_time(), | compare(), etc.
func (MetricsPipelineStage) String ¶ added in v4.2.0
func (m MetricsPipelineStage) 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 SecondPipelineStage ¶ added in v4.2.0
type SecondPipelineStage struct {
Fn string `"|" @("topk"|"bottomk"|"select")`
Count int `"(" ( @Integer`
Labels []string `| @Label_name ( "," @Label_name )* ) ")"`
WithHints *WithClause `@@?`
}
SecondPipelineStage represents: | topk(N), | bottomk(N), or | select(attr1, attr2, ...)
func (SecondPipelineStage) String ¶ added in v4.2.0
func (s SecondPipelineStage) String() string
type Selector ¶
type Selector struct {
AttrSelector *AttrSelectorExp `"{" @@? "}"`
Aggregator *Aggregator `@@?`
MetricsFn *MetricsPipelineStage `@@?`
}
type TraceQLScript ¶
type TraceQLScript struct {
ParenExpr *TraceQLScript `( "(" @@ ")"`
Head Selector `| @@ )`
Op string `@(Descendant|NotDescendant|Ancestor|NotAncestor|Sibling|And|Or)?`
Tail *TraceQLScript `@@?`
// MetricsFn at the script level supports: ({A} &>> {B}) | rate()
MetricsFn *MetricsPipelineStage `@@?`
WithHints *WithClause `@@?`
SecondStage *SecondPipelineStage `@@?`
}
func Parse ¶
func Parse(str string) (*TraceQLScript, error)
func (TraceQLScript) ResolvedHead ¶ added in v4.2.0
func (l TraceQLScript) ResolvedHead() *Selector
ResolvedHead returns the effective head selector, following ParenExpr if needed.
func (TraceQLScript) ResolvedMetricsFn ¶ added in v4.2.0
func (l TraceQLScript) ResolvedMetricsFn() *MetricsPipelineStage
ResolvedMetricsFn returns the MetricsFn from either the script level or the head selector.
func (TraceQLScript) String ¶
func (l TraceQLScript) String() string
type Value ¶
type WithClause ¶ added in v4.2.0
type WithClause struct {
Hints []WithHint `"with" "(" @@ ( "," @@ )* ")"`
}
WithClause represents: with(key=value, ...)
func (WithClause) String ¶ added in v4.2.0
func (w WithClause) String() string
Click to show internal directories.
Click to hide internal directories.