Documentation
¶
Index ¶
- type BoolExpressionEvaluator
- type Boolean
- type BooleanExpression
- type BooleanValue
- type Bytes
- type CompareOp
- type Comparison
- type Enum
- type EnumParser
- type EnumSymbol
- type ExprFunc
- type Field
- type GetSetter
- type Getter
- type Invocation
- type IsNil
- type Literal
- type Logger
- type NoOpLogger
- type OpAndBooleanValue
- type OpOrTerm
- type ParsedQuery
- type Parser
- type Path
- type PathExpressionParser
- type Query
- type Setter
- type StandardGetSetter
- type Term
- type TransformContext
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoolExpressionEvaluator ¶
type BoolExpressionEvaluator = func(ctx TransformContext) bool
BoolExpressionEvaluator is a function that returns the result.
type Boolean ¶
type Boolean bool
Boolean Type for capturing booleans, see: https://github.com/alecthomas/participle#capturing-boolean-value
type BooleanExpression ¶
BooleanExpression represents a true/false decision expressed as an arbitrary number of terms separated by OR.
type BooleanValue ¶
type BooleanValue struct { Comparison *Comparison `parser:"( @@"` ConstExpr *Boolean `parser:"| @Boolean"` SubExpr *BooleanExpression `parser:"| '(' @@ ')' )"` }
BooleanValue represents something that evaluates to a boolean -- either an equality or inequality, explicit true or false, or a parenthesized subexpression.
type CompareOp ¶ added in v0.60.0
type CompareOp int
CompareOp is the type of a comparison operator.
type Comparison ¶
type Comparison struct { Left Value `parser:"@@"` Op CompareOp `parser:"@OpComparison"` Right Value `parser:"@@"` }
Comparison represents an optional boolean condition.
type EnumParser ¶
type EnumParser func(*EnumSymbol) (*Enum, error)
type EnumSymbol ¶
type EnumSymbol string
type ExprFunc ¶
type ExprFunc func(ctx TransformContext) interface{}
type Field ¶
type Field struct { Name string `parser:"@Lowercase"` MapKey *string `parser:"( '[' @String ']' )?"` }
Field is an item within a Path.
type Getter ¶
type Getter interface {
Get(ctx TransformContext) interface{}
}
type Invocation ¶
type Invocation struct { Function string `parser:"@(Uppercase | Lowercase)+"` Arguments []Value `parser:"'(' ( @@ ( ',' @@ )* )? ')'"` }
Invocation represents a function call.
type Literal ¶ added in v0.57.2
type Literal struct {
Value interface{}
}
func (Literal) Get ¶ added in v0.57.2
func (l Literal) Get(ctx TransformContext) interface{}
type Logger ¶ added in v0.60.0
type Logger interface { WithFields(field map[string]any) Logger Info(msg string) Error(msg string) }
Logger allows printing logs inside TQL functions using a logging framework provided by the component using the TQL.
type NoOpLogger ¶ added in v0.60.0
type NoOpLogger struct{}
func (NoOpLogger) Error ¶ added in v0.60.0
func (nol NoOpLogger) Error(msg string)
func (NoOpLogger) Info ¶ added in v0.60.0
func (nol NoOpLogger) Info(msg string)
func (NoOpLogger) WithFields ¶ added in v0.60.0
func (nol NoOpLogger) WithFields(field map[string]any) Logger
type OpAndBooleanValue ¶
type OpAndBooleanValue struct { Operator string `parser:"@OpAnd"` Value *BooleanValue `parser:"@@"` }
OpAndBooleanValue represents the right side of an AND boolean expression.
type ParsedQuery ¶
type ParsedQuery struct { Invocation Invocation `parser:"@@"` WhereClause *BooleanExpression `parser:"( 'where' @@ )?"` }
ParsedQuery represents a parsed query. It is the entry point into the query DSL.
type Parser ¶ added in v0.60.0
type Parser struct {
// contains filtered or unexported fields
}
func NewParser ¶ added in v0.60.0
func NewParser(functions map[string]interface{}, pathParser PathExpressionParser, enumParser EnumParser, logger Logger) Parser
func (*Parser) NewFunctionCall ¶ added in v0.60.0
func (p *Parser) NewFunctionCall(inv Invocation) (ExprFunc, error)
NewFunctionCall Visible for testing
type Path ¶
type Path struct {
Fields []Field `parser:"@@ ( '.' @@ )*"`
}
Path represents a telemetry path expression.
type PathExpressionParser ¶
type Query ¶
type Query struct { Function ExprFunc Condition BoolExpressionEvaluator }
Query holds a top level Query for processing telemetry data. A Query is a combination of a function invocation and the expression to match telemetry for invoking the function.
type Setter ¶
type Setter interface {
Set(ctx TransformContext, val interface{})
}
type StandardGetSetter ¶ added in v0.57.2
type StandardGetSetter struct { Getter func(ctx TransformContext) interface{} Setter func(ctx TransformContext, val interface{}) }
func (StandardGetSetter) Get ¶ added in v0.57.2
func (path StandardGetSetter) Get(ctx TransformContext) interface{}
func (StandardGetSetter) Set ¶ added in v0.57.2
func (path StandardGetSetter) Set(ctx TransformContext, val interface{})
type Term ¶
type Term struct { Left *BooleanValue `parser:"@@"` Right []*OpAndBooleanValue `parser:"@@*"` }
Term represents an arbitrary number of boolean values joined by AND.
type TransformContext ¶
type TransformContext interface { GetItem() interface{} GetInstrumentationScope() pcommon.InstrumentationScope GetResource() pcommon.Resource }
type Value ¶
type Value struct { Invocation *Invocation `parser:"( @@"` Bytes *Bytes `parser:"| @Bytes"` String *string `parser:"| @String"` Float *float64 `parser:"| @Float"` Int *int64 `parser:"| @Int"` Bool *Boolean `parser:"| @Boolean"` IsNil *IsNil `parser:"| @'nil'"` Enum *EnumSymbol `parser:"| @Uppercase"` Path *Path `parser:"| @@ )"` }
Value represents a part of a parsed query which is resolved to a value of some sort. This can be a telemetry path expression, function call, or literal.