Documentation ¶
Overview ¶
Package traceqlengine implements TraceQL evaluation engine.
Index ¶
- Variables
- func ReduceExpr(expr traceql.TypedExpr) traceql.TypedExpr
- type AggregateEvalauter
- type Aggregator
- type AttributeEvaluater
- type AvgAgg
- type BinaryEvaluater
- type BinaryExpr
- type BinaryOp
- type BinarySpansetExpr
- type CountAgg
- type Engine
- type EvalParams
- type EvaluateCtx
- type Evaluater
- type MaxAgg
- type MemoryQuerier
- type MinAgg
- type NegEvaluater
- type NotEvaluater
- type Options
- type ParentEvaluater
- type Pipeline
- type Processor
- type Querier
- type ResourceAttributeEvaluater
- type RootServiceNameEvaluater
- type RootSpanNameEvaluater
- type ScalarFilter
- type SelectSpansetsParams
- type SpanAttributeEvaluater
- type SpanDurationEvalauter
- type SpanKindEvaluater
- type SpanMatcher
- type SpanNameEvaluater
- type SpanStatusEvaluater
- type Spanset
- type SpansetFilter
- type SpansetOp
- type StaticEvaluater
- type SumAgg
- type Trace
- type TraceDurationEvaluater
- type UnsupportedError
Constants ¶
This section is empty.
Variables ¶
var NopProcessor = &nopProcessor{}
NopProcessor is a processor that does nothing.
Functions ¶
Types ¶
type AggregateEvalauter ¶
type AggregateEvalauter[A Aggregator] struct { Agg A }
AggregateEvalauter evaluates aggregation expression.
func (*AggregateEvalauter[A]) Eval ¶
func (e *AggregateEvalauter[A]) Eval(_ tracestorage.Span, ctx EvaluateCtx) (r traceql.Static)
Eval implemenets Evaluater.
type Aggregator ¶
Aggregator is an aggregation expression.
type AttributeEvaluater ¶
type AttributeEvaluater struct {
Name string
}
AttributeEvaluater evaluates attribute selector.
func (*AttributeEvaluater) Eval ¶
func (e *AttributeEvaluater) Eval(span tracestorage.Span, _ EvaluateCtx) traceql.Static
Eval implemenets Evaluater.
type BinaryEvaluater ¶
BinaryEvaluater is a binary operation Evaluater.
func (*BinaryEvaluater) Eval ¶
func (e *BinaryEvaluater) Eval(span tracestorage.Span, ctx EvaluateCtx) traceql.Static
Eval implemenets Evaluater.
type BinaryExpr ¶
type BinaryExpr struct {
// contains filtered or unexported fields
}
BinaryExpr merges two pipelines.
type BinarySpansetExpr ¶
BinarySpansetExpr merges two spansets.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is a TraceQL evaluation engine.
type EvalParams ¶
type EvalParams struct { // Trace duration to search, optional. MinDuration time.Duration MaxDuration time.Duration // Time range to search, optional. Start otelstorage.Timestamp End otelstorage.Timestamp Limit int }
EvalParams sets evaluation parameters.
type Evaluater ¶
type Evaluater interface {
Eval(span tracestorage.Span, ctx EvaluateCtx) traceql.Static
}
Evaluater evaluates TraceQL expression.
type MemoryQuerier ¶
type MemoryQuerier struct {
// contains filtered or unexported fields
}
MemoryQuerier is a simple in-memory querier, used for tests.
func (*MemoryQuerier) Add ¶
func (q *MemoryQuerier) Add(span tracestorage.Span)
Add adds span to data set.
NOTE: There is no synchronization. Do not call this function concurrently with other methods.
func (*MemoryQuerier) SelectSpansets ¶
func (q *MemoryQuerier) SelectSpansets(context.Context, SelectSpansetsParams) (iterators.Iterator[Trace], error)
SelectSpansets get spansets from storage.
type NegEvaluater ¶
type NegEvaluater struct {
Sub Evaluater
}
NegEvaluater is a unary negation operation Evaluater.
func (*NegEvaluater) Eval ¶
func (e *NegEvaluater) Eval(span tracestorage.Span, ctx EvaluateCtx) (r traceql.Static)
Eval implemenets Evaluater.
type NotEvaluater ¶
type NotEvaluater struct {
Sub Evaluater
}
NotEvaluater is a unary NOT operation Evaluater.
func (*NotEvaluater) Eval ¶
func (e *NotEvaluater) Eval(span tracestorage.Span, ctx EvaluateCtx) (r traceql.Static)
Eval implemenets Evaluater.
type Options ¶
type Options struct { // TracerProvider provides OpenTelemetry tracer for this engine. TracerProvider trace.TracerProvider }
Options sets Engine options.
type ParentEvaluater ¶
type ParentEvaluater struct{}
ParentEvaluater evaluates `parent` property.
func (*ParentEvaluater) Eval ¶
func (*ParentEvaluater) Eval(span tracestorage.Span, _ EvaluateCtx) (r traceql.Static)
Eval implemenets Evaluater.
type Processor ¶
Processor is a log record processor.
func BuildBinaryExpr ¶
func BuildBinaryExpr(expr *traceql.BinaryExpr) (Processor, error)
BuildBinaryExpr builds a new binary expression processor.
func BuildPipeline ¶
func BuildPipeline(stages ...traceql.PipelineStage) (Processor, error)
BuildPipeline builds a new Pipeline.
type Querier ¶
type Querier interface { // SelectSpansets get spansets from storage. SelectSpansets(ctx context.Context, params SelectSpansetsParams) (iterators.Iterator[Trace], error) }
Querier does queries to storage.
type ResourceAttributeEvaluater ¶
type ResourceAttributeEvaluater struct {
Name string
}
ResourceAttributeEvaluater evaluates resource attribute selector.
func (*ResourceAttributeEvaluater) Eval ¶
func (e *ResourceAttributeEvaluater) Eval(span tracestorage.Span, _ EvaluateCtx) traceql.Static
Eval implemenets Evaluater.
type RootServiceNameEvaluater ¶
type RootServiceNameEvaluater struct{}
RootServiceNameEvaluater evaluates `rootServiceName` property.
func (*RootServiceNameEvaluater) Eval ¶
func (*RootServiceNameEvaluater) Eval(_ tracestorage.Span, ctx EvaluateCtx) (r traceql.Static)
Eval implemenets Evaluater.
type RootSpanNameEvaluater ¶
type RootSpanNameEvaluater struct{}
RootSpanNameEvaluater evaluates `rootName` property.
func (*RootSpanNameEvaluater) Eval ¶
func (*RootSpanNameEvaluater) Eval(_ tracestorage.Span, ctx EvaluateCtx) (r traceql.Static)
Eval implemenets Evaluater.
type ScalarFilter ¶
type ScalarFilter struct {
Eval Evaluater
}
ScalarFilter filters Scalars by field expression.
type SelectSpansetsParams ¶
type SelectSpansetsParams struct { Op traceql.SpansetOp // OpAnd, OpOr Matchers []SpanMatcher // Time range to query, optional. Start, End otelstorage.Timestamp // Trace duration, querier should ignore field, if it is zero. // TODO(tdakkota): probably, we can put it as SpanMatcher with traceDuration attribute // but it would not work properly with OpOr. MinDuration time.Duration MaxDuration time.Duration Limit int }
SelectSpansetsParams is a storage query params.
type SpanAttributeEvaluater ¶
type SpanAttributeEvaluater struct {
Name string
}
SpanAttributeEvaluater evaluates Span attribute selector.
func (*SpanAttributeEvaluater) Eval ¶
func (e *SpanAttributeEvaluater) Eval(span tracestorage.Span, _ EvaluateCtx) traceql.Static
Eval implemenets Evaluater.
type SpanDurationEvalauter ¶
type SpanDurationEvalauter struct{}
SpanDurationEvalauter evaluates `duration` property.
func (*SpanDurationEvalauter) Eval ¶
func (*SpanDurationEvalauter) Eval(span tracestorage.Span, _ EvaluateCtx) (r traceql.Static)
Eval implemenets Evaluater.
type SpanKindEvaluater ¶
type SpanKindEvaluater struct{}
SpanKindEvaluater evaluates `kind` property.
func (*SpanKindEvaluater) Eval ¶
func (*SpanKindEvaluater) Eval(span tracestorage.Span, _ EvaluateCtx) (r traceql.Static)
Eval implemenets Evaluater.
type SpanMatcher ¶
type SpanMatcher struct { Attribute traceql.Attribute Op traceql.BinaryOp // could be zero, look for spans with such attribute Static traceql.Static }
SpanMatcher defines span predicate to select.
func (SpanMatcher) String ¶ added in v0.12.2
func (m SpanMatcher) String() string
String implements fmt.Stringer.
type SpanNameEvaluater ¶
type SpanNameEvaluater struct{}
SpanNameEvaluater evaluates `name` property.
func (*SpanNameEvaluater) Eval ¶
func (*SpanNameEvaluater) Eval(span tracestorage.Span, _ EvaluateCtx) (r traceql.Static)
Eval implemenets Evaluater.
type SpanStatusEvaluater ¶
type SpanStatusEvaluater struct{}
SpanStatusEvaluater evaluates `status` property.
func (*SpanStatusEvaluater) Eval ¶
func (*SpanStatusEvaluater) Eval(span tracestorage.Span, _ EvaluateCtx) (r traceql.Static)
Eval implemenets Evaluater.
type Spanset ¶
type Spanset struct { TraceID otelstorage.TraceID Spans []tracestorage.Span Start time.Time RootSpanName string RootServiceName string TraceDuration time.Duration }
Spanset is a set of spans.
type SpansetFilter ¶
type SpansetFilter struct {
Eval Evaluater
}
SpansetFilter filters spansets by field expression.
type SpansetOp ¶
type SpansetOp func(a, b []Spanset) ([]tracestorage.Span, error)
SpansetOp merges two spansets.
type StaticEvaluater ¶
StaticEvaluater is a Evaluater returning a static value.
func (*StaticEvaluater) Eval ¶
func (e *StaticEvaluater) Eval(tracestorage.Span, EvaluateCtx) traceql.Static
Eval implemenets Evaluater.
type Trace ¶
type Trace struct { TraceID otelstorage.TraceID Spans []tracestorage.Span }
Trace is set of span grouped by trace ID.
type TraceDurationEvaluater ¶
type TraceDurationEvaluater struct{}
TraceDurationEvaluater evaluates `traceDuration“ property.
func (*TraceDurationEvaluater) Eval ¶
func (*TraceDurationEvaluater) Eval(_ tracestorage.Span, ctx EvaluateCtx) (r traceql.Static)
Eval implemenets Evaluater.
type UnsupportedError ¶
type UnsupportedError struct {
Msg string
}
UnsupportedError is an error that reports unsupported expressions.