traceql_parser

package
v4.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TraceQLLexerDefinition = lexer.MustSimple(TraceQLLexerRulesV2)
View Source
var TraceQLLexerRulesV2 = []lexer.SimpleRule{
	{Name: "Ocb", Pattern: `\{`},
	{Name: "Ccb", Pattern: `\}`},

	{Name: "Ob", Pattern: `\(`},
	{Name: "Cb", Pattern: `\)`},

	{Name: "Ge", Pattern: `>=`},
	{Name: "Le", Pattern: `<=`},
	{Name: "Gt", Pattern: `>`},
	{Name: "Lt", Pattern: `<`},

	{Name: "Neq", Pattern: `!=`},
	{Name: "Re", Pattern: `=~`},
	{Name: "Nre", Pattern: `!~`},
	{Name: "Eq", Pattern: `=`},

	{Name: "Label_name", Pattern: `(\.[a-zA-Z_][.a-zA-Z0-9_-]*|[a-zA-Z_][.a-zA-Z0-9_-]*)`},
	{Name: "Dot", Pattern: `\.`},

	{Name: "And", Pattern: `&&`},
	{Name: "Or", Pattern: `\|\|`},

	{Name: "Pipe", Pattern: `\|`},

	{Name: "Quoted_string", Pattern: `"([^"\\]|\\.)*"`},
	{Name: "Ticked_string", Pattern: "`([^`\\\\]|\\\\.)*`"},

	{Name: "Minus", Pattern: "-"},
	{Name: "Integer", Pattern: "[0-9]+"},

	{Name: "space", Pattern: `\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? @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    `(@@`
	ComplexHead *AttrSelectorExp `| "(" @@ ")" )`
	AndOr       string           `@(And|Or)?`
	Tail        *AttrSelectorExp `@@?`
}

func (AttrSelectorExp) String

func (a AttrSelectorExp) 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 Selector

type Selector struct {
	AttrSelector *AttrSelectorExp `"{" @@? "}"`
	Aggregator   *Aggregator      `@@?`
}

func (Selector) String

func (s Selector) String() string

type TraceQLScript

type TraceQLScript struct {
	Head  Selector       `@@`
	AndOr string         `@(And|Or)?`
	Tail  *TraceQLScript `@@?`
}

func Parse

func Parse(str string) (*TraceQLScript, error)

func (TraceQLScript) String

func (l TraceQLScript) String() string

type Value

type Value struct {
	TimeVal string        `@Integer @Dot? @Integer? @("ns"|"us"|"ms"|"s"|"m"|"h"|"d")`
	FVal    string        `| @Minus? @Integer @Dot? @Integer?`
	StrVal  *QuotedString `| @@`
}

func (Value) String

func (v Value) String() string

Jump to

Keyboard shortcuts

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