Documentation ¶
Overview ¶
Package traceql contains TraceQL parser and AST definitions.
Index ¶
- func ExtractMatchers(expr Expr) (SpansetOp, []SpanMatcher)
- func IntrinsicNames() (r []string)
- type AggregateOp
- type AggregateScalarExpr
- type Attribute
- type AttributeScope
- type Autocomplete
- type BinaryExpr
- type BinaryFieldExpr
- type BinaryOp
- func (op BinaryOp) CheckType(t StaticType) bool
- func (op BinaryOp) IsArithmetic() bool
- func (op BinaryOp) IsBoolean() bool
- func (op BinaryOp) IsEqual() bool
- func (op BinaryOp) IsLogic() bool
- func (op BinaryOp) IsOrdering() bool
- func (op BinaryOp) IsRegex() bool
- func (op BinaryOp) Precedence() int
- func (op BinaryOp) String() string
- type BinaryScalarExpr
- type BinarySpansetExpr
- type CoalesceOperation
- type Expr
- type FieldExpr
- type GroupOperation
- type PipelineStage
- type ScalarExpr
- type ScalarFilter
- type SelectOperation
- type SpanMatcher
- type SpanProperty
- type SpansetExpr
- type SpansetFilter
- type SpansetOp
- type SpansetPipeline
- type Static
- func (s *Static) AsBool() bool
- func (s *Static) AsDuration() time.Duration
- func (s *Static) AsInt() int64
- func (s *Static) AsNumber() float64
- func (s *Static) AsSpanKind() ptrace.SpanKind
- func (s *Static) AsSpanStatus() ptrace.StatusCode
- func (s *Static) AsString() string
- func (s *Static) Compare(to Static) int
- func (s *Static) IsNil() bool
- func (s *Static) SetBool(v bool)
- func (s *Static) SetDuration(v time.Duration)
- func (s *Static) SetInt(v int64)
- func (s *Static) SetNil()
- func (s *Static) SetNumber(v float64)
- func (s *Static) SetOTELValue(val pcommon.Value) bool
- func (s *Static) SetSpanKind(kind ptrace.SpanKind)
- func (s *Static) SetSpanStatus(status ptrace.StatusCode)
- func (s *Static) SetString(v string)
- func (s *Static) ToFloat() float64
- func (s *Static) ValueType() StaticType
- type StaticType
- type SyntaxError
- type TypeError
- type TypedExpr
- type UnaryFieldExpr
- type UnaryOp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractMatchers ¶ added in v0.13.0
func ExtractMatchers(expr Expr) (SpansetOp, []SpanMatcher)
ExtractMatchers returns SpanMatcher list extracted from Expr.
func IntrinsicNames ¶ added in v0.12.0
func IntrinsicNames() (r []string)
IntrinsicNames returns a slice of intrinsics.
Types ¶
type AggregateOp ¶
type AggregateOp int
AggregateOp defines aggregation operator.
const ( AggregateOpCount AggregateOp = iota + 1 AggregateOpMax AggregateOpMin AggregateOpAvg AggregateOpSum )
type AggregateScalarExpr ¶
type AggregateScalarExpr struct { Op AggregateOp Field FieldExpr // nilable }
AggregateScalarExpr is an aggregate function.
func (*AggregateScalarExpr) ValueType ¶
func (s *AggregateScalarExpr) ValueType() StaticType
ValueType returns value type of expression.
type Attribute ¶
type Attribute struct { Name string Scope AttributeScope Prop SpanProperty Parent bool // refers to parent }
Attribute is a span attribute.
func ParseAttribute ¶ added in v0.12.0
ParseAttribute parses attribute from given string.
func (*Attribute) ValueType ¶
func (s *Attribute) ValueType() StaticType
ValueType returns value type of expression.
type AttributeScope ¶
type AttributeScope uint8
AttributeScope is an attribute scope.
const ( ScopeNone AttributeScope = iota ScopeResource ScopeSpan ScopeInstrumentation )
func (AttributeScope) String ¶ added in v0.12.0
func (s AttributeScope) String() string
String implements fmt.Stringer.
type Autocomplete ¶ added in v0.12.0
type Autocomplete struct {
Matchers []SpanMatcher
}
Autocomplete is a AND set of spanset matchers.
func ParseAutocomplete ¶ added in v0.12.0
func ParseAutocomplete(input string) Autocomplete
ParseAutocomplete parses matchers from potentially uncomplete TraceQL spanset filter from string.
func (Autocomplete) String ¶ added in v0.13.0
func (c Autocomplete) String() string
String implements fmt.Stringer for Autocomplete.
type BinaryExpr ¶
BinaryExpr is a binary expression.
type BinaryFieldExpr ¶
BinaryFieldExpr is a binary operation between two field expressions.
func (*BinaryFieldExpr) ValueType ¶
func (s *BinaryFieldExpr) ValueType() StaticType
ValueType returns value type of expression.
type BinaryOp ¶
type BinaryOp int
BinaryOp defines binary operator.
func (BinaryOp) CheckType ¶
func (op BinaryOp) CheckType(t StaticType) bool
CheckType checks if operator can be applied to given type.
func (BinaryOp) IsArithmetic ¶
IsArithmetic whether op is arithmetic operator.
func (BinaryOp) IsOrdering ¶
IsOrdering whether op is ordering operator.
func (BinaryOp) Precedence ¶
Precedence returns operator precedence.
type BinaryScalarExpr ¶
type BinaryScalarExpr struct { Left ScalarExpr Op BinaryOp Right ScalarExpr }
BinaryScalarExpr is a binary operation between two scalar expressions.
func (*BinaryScalarExpr) ValueType ¶
func (s *BinaryScalarExpr) ValueType() StaticType
ValueType returns value type of expression.
type BinarySpansetExpr ¶
type BinarySpansetExpr struct { Left SpansetExpr Op SpansetOp Right SpansetExpr }
BinarySpansetExpr is a binary operation between two spanset expressions.
type CoalesceOperation ¶
type CoalesceOperation struct{}
CoalesceOperation is a `colaesce()` operation.
type Expr ¶
type Expr interface {
// contains filtered or unexported methods
}
Expr is a TraceQL expression.
type FieldExpr ¶
type FieldExpr interface { TypedExpr // contains filtered or unexported methods }
FieldExpr is a field expression.
type GroupOperation ¶
type GroupOperation struct {
By FieldExpr
}
GroupOperation is a `by()` operation.
type PipelineStage ¶
type PipelineStage interface {
// contains filtered or unexported methods
}
PipelineStage is a pipeline stage.
type ScalarExpr ¶
type ScalarExpr interface { TypedExpr // contains filtered or unexported methods }
ScalarExpr is a scalar expression.
type ScalarFilter ¶
type ScalarFilter struct { Left ScalarExpr Op BinaryOp Right ScalarExpr }
ScalarFilter is a scalar filter.
type SelectOperation ¶
type SelectOperation struct {
Args []FieldExpr
}
SelectOperation is a `select()` operation.
type SpanMatcher ¶ added in v0.13.0
type SpanMatcher struct { Attribute Attribute Op BinaryOp // could be zero, look for spans with such attribute Static Static }
SpanMatcher defines span predicate to select.
func (SpanMatcher) String ¶ added in v0.13.0
func (m SpanMatcher) String() string
String implements fmt.Stringer.
type SpanProperty ¶
type SpanProperty uint8
SpanProperty is a span property.
const ( SpanAttribute SpanProperty = iota SpanDuration SpanChildCount SpanName SpanStatus SpanKind SpanParent RootSpanName RootServiceName TraceDuration )
type SpansetExpr ¶
type SpansetExpr interface { PipelineStage // contains filtered or unexported methods }
SpansetExpr is a spanset expression.
type SpansetFilter ¶
type SpansetFilter struct {
Expr FieldExpr // if filter is empty, expr is True
}
SpansetFilter is a spanset filter.
type SpansetOp ¶
type SpansetOp int
SpansetOp defines spanset operator.
func (SpansetOp) Precedence ¶
Precedence returns operator precedence.
type SpansetPipeline ¶
type SpansetPipeline struct {
Pipeline []PipelineStage
}
SpansetPipeline is a spanset pipeline.
type Static ¶
type Static struct { Type StaticType Data uint64 // stores everything, except strings Str string }
Static is a constant value.
func (*Static) AsDuration ¶
AsDuration returns Duration value.
func (*Static) AsSpanKind ¶
AsSpanKind returns SpanKind value.
func (*Static) AsSpanStatus ¶
func (s *Static) AsSpanStatus() ptrace.StatusCode
AsSpanStatus returns SpanStatus value.
func (*Static) SetDuration ¶
SetDuration sets Duration value.
func (*Static) SetOTELValue ¶
SetOTELValue sets value from given OpenTelemetry data value.
SetOTELValue returns false, if pcommon.Value cannot be represent as Static.
func (*Static) SetSpanKind ¶
SetSpanKind sets SpanKind value.
func (*Static) SetSpanStatus ¶
func (s *Static) SetSpanStatus(status ptrace.StatusCode)
SetSpanStatus sets SpanStatus value.
func (*Static) ValueType ¶
func (s *Static) ValueType() StaticType
ValueType returns value type of expression.
type StaticType ¶
type StaticType int
StaticType defines static type.
const ( TypeAttribute StaticType = iota TypeString TypeInt TypeNumber TypeBool TypeNil TypeDuration TypeSpanStatus TypeSpanKind )
func StaticTypeFromValueType ¶ added in v0.12.1
func StaticTypeFromValueType(typ pcommon.ValueType) StaticType
StaticTypeFromValueType converts pcommon.ValueType to StaticType.
func (StaticType) CheckOperand ¶
func (s StaticType) CheckOperand(s2 StaticType) bool
CheckOperand whether is a and b are valid operands.
func (StaticType) IsNumeric ¶
func (s StaticType) IsNumeric() bool
IsNumeric returns true if type is numeric.
type SyntaxError ¶
SyntaxError is a syntax error.
type TypedExpr ¶
type TypedExpr interface {
ValueType() StaticType
}
TypedExpr is an interface for typed expression.
type UnaryFieldExpr ¶
UnaryFieldExpr is a unary field expression operation.
func (*UnaryFieldExpr) ValueType ¶
func (s *UnaryFieldExpr) ValueType() StaticType
ValueType returns value type of expression.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package lexer contains TraceQL lexer.
|
Package lexer contains TraceQL lexer. |
Package traceqlengine implements TraceQL evaluation engine.
|
Package traceqlengine implements TraceQL evaluation engine. |