Documentation
¶
Overview ¶
Code generated by goyacc -l -o pkg/traceql/expr.y.go pkg/traceql/expr.y. DO NOT EDIT.
Index ¶
- Constants
- Variables
- func AlignEndToLeft(req *tempopb.QueryRangeRequest)
- func AlignRequest(req *tempopb.QueryRangeRequest)
- func Compile(query string, opts ...CompileOption) (*RootExpr, Pipeline, SpansetFilterFunc, *FetchSpansRequest, error)
- func ContainsNonAttributeRune(s string) bool
- func DefaultQueryRangeStep(start, end uint64) uint64
- func ExtractConditionGroups(query string, maxGroups int) ([][]Condition, error)
- func IsEmptyQuery(query string) bool
- func IsInstant(req *tempopb.QueryRangeRequest) bool
- func IsValidTransformationName(name string) bool
- func KnownTransformationNames() []string
- func Log2Bucketize(v uint64) float64
- func Log2Quantile(p float64, buckets []HistogramBucket) float64
- func Log2QuantileWithBucket(p float64, buckets []HistogramBucket) (float64, int)
- func MakeCollectTagValueFunc(collect func(tempopb.TagValue) bool) func(v Static) bool
- func NeedsFullTrace(e ...Element) bool
- func NormalizeQuery(query string) string
- func TrimToAfter(req *tempopb.QueryRangeRequest, before time.Time)
- func TrimToBefore(req *tempopb.QueryRangeRequest, before time.Time)
- func TrimToBlockOverlap(req *tempopb.QueryRangeRequest, blockStart, blockEnd time.Time) (uint64, uint64, uint64)
- func Validate(expr *RootExpr) error
- type ASTRewriter
- type Aggregate
- type AggregateMode
- type AggregateOp
- type Attribute
- type AttributeScope
- type BaselineAggregator
- type BinaryOperation
- type ChainedSecondStage
- type CoalesceOperation
- type CommonIterator
- type CompileOption
- type Condition
- type CountOverTimeAggregator
- type Element
- type Engine
- func (e *Engine) CompileMetricsQueryRange(req *tempopb.QueryRangeRequest, opts ...CompileOption) (MetricsEvaluator, error)
- func (e *Engine) CompileMetricsQueryRangeNonRaw(req *tempopb.QueryRangeRequest, mode AggregateMode, opts ...CompileOption) (*MetricsFrontendEvaluator, error)
- func (e *Engine) ExecuteSearch(ctx context.Context, searchReq *tempopb.SearchRequest, fetcher SpansetFetcher, ...) (*tempopb.SearchResponse, error)
- func (e *Engine) ExecuteTagNames(ctx context.Context, scope AttributeScope, conditionGroups [][]Condition, ...) error
- func (e *Engine) ExecuteTagValues(ctx context.Context, tag Attribute, conditionGroups [][]Condition, ...) error
- type Exemplar
- type FastStatic
- type FastStatic1
- type FastStatic2
- type FastStatic3
- type FastStatic4
- type FastStatic5
- type FetchSpansOnlyResponse
- type FetchSpansRequest
- type FetchSpansResponse
- type FetchTagValuesCallback
- type FetchTagValuesRequest
- type FetchTagsCallback
- type FetchTagsRequest
- type FieldExpression
- type GroupOperation
- type GroupingAggregator
- type Hint
- type Hints
- func (h *Hints) Get(k string, t StaticType, allowUnsafe bool) (v Static, ok bool)
- func (h *Hints) GetBool(k string, allowUnsafe bool) (v, ok bool)
- func (h *Hints) GetDuration(k string, allowUnsafe bool) (v time.Duration, ok bool)
- func (h *Hints) GetFloat(k string, allowUnsafe bool) (v float64, ok bool)
- func (h *Hints) GetInt(k string, allowUnsafe bool) (v int, ok bool)
- func (h *Hints) GetStringSlice(k string, allowUnsafe bool) (v []string, ok bool)
- func (h *Hints) String() string
- type Histogram
- type HistogramAggregator
- type HistogramBucket
- type InstantAggregator
- type IntervalMapper
- type IntervalMapperInstant
- type IntervalMapperQueryRange
- type Intrinsic
- type Kind
- type Label
- type Labels
- type MetadataCombiner
- type MetricsAggregate
- type MetricsAggregateOp
- type MetricsCompare
- type MetricsEvaluator
- type MetricsFilter
- type MetricsFrontendEvaluator
- type Operands
- type Operator
- type OverTimeAggregator
- type ParseError
- type Pipeline
- type PipelineElement
- type QueryRangeCombiner
- type RangeAggregator
- type RootExpr
- func ApplyASTRewrites(r *RootExpr, skip []string) *RootExpr
- func CompileFetchSpanRequests(query string, opts ...CompileOption) (*RootExpr, map[string]FetchSpansRequest, error)
- func Parse(s string, opts ...CompileOption) (expr *RootExpr, err error)
- func ParseLenient(s string) (*RootExpr, error)
- func ParseNoOptimizations(s string) (*RootExpr, error)
- type Sampler
- type ScalarExpression
- type ScalarFilter
- type ScalarOperation
- type SecondPassFn
- type SecondStageOp
- type SelectOperation
- type SeriesAggregator
- type SeriesMapKey
- type SeriesMapLabel
- type SeriesSet
- type ServiceStats
- type SimpleAggregationOp
- type SimpleAggregator
- type Span
- type SpanAggregator
- type SpanIterator
- type Spanset
- type SpansetAttribute
- type SpansetExpression
- type SpansetFetcher
- type SpansetFetcherWrapper
- type SpansetFilter
- type SpansetFilterFunc
- type SpansetIterator
- type SpansetOperation
- type Static
- func NewStaticBool(b bool) Static
- func NewStaticBooleanArray(b []bool) Static
- func NewStaticDuration(d time.Duration) Static
- func NewStaticFloat(f float64) Static
- func NewStaticFloatArray(f []float64) Static
- func NewStaticInt(i int) Static
- func NewStaticIntArray(i []int) Static
- func NewStaticKind(k Kind) Static
- func NewStaticNil() Static
- func NewStaticStatus(s Status) Static
- func NewStaticString(s string) Static
- func NewStaticStringArray(s []string) Static
- func StaticFromAnyValue(a *common_v1.AnyValue) Static
- func (s Static) AsAnyValue() *common_v1.AnyValue
- func (s Static) Bool() (bool, bool)
- func (s Static) BooleanArray() ([]bool, bool)
- func (s Static) Duration() (time.Duration, bool)
- func (s Static) Elements() iter.Seq2[int, Static]
- func (s Static) EncodeToString(quotes bool) string
- func (s Static) Equals(o *Static) bool
- func (s Static) Float() float64
- func (s Static) FloatArray() ([]float64, bool)
- func (s Static) Int() (int, bool)
- func (s Static) Int64Array() ([]int64, bool)
- func (s Static) IntArray() ([]int, bool)
- func (s Static) IsNil() bool
- func (s Static) Kind() (Kind, bool)
- func (s Static) MapKey() StaticMapKey
- func (s Static) NotEquals(o *Static) bool
- func (s Static) Status() (Status, bool)
- func (s Static) StrictEquals(o *Static) bool
- func (s Static) String() string
- func (s Static) StringArray() ([]string, bool)
- type StaticMapKey
- type StaticType
- type StaticVals
- type StaticVals1
- type StaticVals2
- type StaticVals3
- type StaticVals4
- type StaticVals5
- type Status
- type StepAggregator
- type TagNamesFetcher
- type TagNamesFetcherWrapper
- type TagValuesFetcher
- type TagValuesFetcherWrapper
- type TimeSeries
- type TopKBottomK
- type UnaryOperation
- type UngroupedAggregator
- type VectorAggregator
Constants ¶
const ( // TransformationOrToIn is the name of the rewriter that converts OR/AND chains to IN/NOT IN/MATCH ANY/MATCH NONE. TransformationOrToIn = "or_to_in" // TransformationAll is a special name that disables all AST transformations. TransformationAll = "all" )
const ( // AggregateModeRaw is the version that runs directly on spans. // It yields the first level of raw time series. AggregateModeRaw = iota // AggregateModeSum is the version that performs the next stages // after raw. This is how to combine results from multiple jobs or pods, but still not // the final results. For example rate/count are simple addition, min/max compute // another level of min/maxing. AggregateModeSum // AggregateModeFinal is the version that must run in a single place and cannot be // subdivided. This includes the computation of quantiles, averages, etc. AggregateModeFinal )
const ( HintSample = "sample" HintTraceSample = "trace_sample" HintSpanSample = "span_sample" HintJobSize = "job_size" HintTimeOverlapCutoff = "time_overlap_cutoff" HintConcurrentBlocks = "concurrent_blocks" HintExemplars = "exemplars" HintMostRecent = "most_recent" // traceql search hint to return most recent results ordered by time HintDebug = "debug" HintInfo = "info" HintDebugReturnIn = "debug_return_in" // performance testing hint to simulate query latency and return fake data HintDebugStdDev = "debug_std_dev" // standard deviation for debug_return_in latency simulation HintDebugDataFactor = "debug_data_factor" // performance testing hint to control the possibility of non-empty fake data HintSkipASTTransformations = "skip_ast_transformations" // list of AST transformation names to skip; unsafe hint HintNewFetch = "spanonly_fetch" // metrics: new fetch layer (only in vParquet5) )
The list of all traceql query hints. Although most of these are implementation-specific and not part of the language or engine, we organize them here in one place.
const ADD = 57444
const ANCE = 57433
const AND = 57422
const AVG = 57401
const AVG_OVER_TIME = 57413
const BOTTOMK = 57419
const BY = 57405
const CHILDCOUNT = 57370
const CLOSE_BRACE = 57353
const CLOSE_PARENS = 57355
const COALESCE = 57406
const COMMA = 57356
const COMPARE = 57417
const COUNT = 57400
const COUNT_OVER_TIME = 57410
const DESC = 57432
const DIV = 57448
const DOT = 57351
const DURATION = 57350
const DefaultMaxConditionGroupsPerTagQuery = 100
DefaultMaxConditionGroupsPerTagQuery is the default cap on the number of OR-expanded condition groups to prevent exponential blowup from queries with many OR clauses. Configurable via overrides.
const (
DefaultSpansPerSpanSet int = 3
)
const END_ATTRIBUTE = 57408
const EQ = 57424
const EVENT_COLON = 57394
const EVENT_DOT = 57395
const FALSE = 57359
const FLOAT = 57349
const GT = 57428
const GTE = 57429
const HISTOGRAM_OVER_TIME = 57416
const ID = 57383
const IDENTIFIER = 57346
const IDURATION = 57369
const INSTRUMENTATION_COLON = 57398
const INSTRUMENTATION_DOT = 57399
const INTEGER = 57348
const KIND = 57375
const KIND_CLIENT = 57366
const KIND_CONSUMER = 57368
const KIND_INTERNAL = 57364
const KIND_PRODUCER = 57367
const KIND_SERVER = 57365
const KIND_UNSPECIFIED = 57363
const LINK_COLON = 57396
const LINK_DOT = 57397
const LT = 57426
const LTE = 57427
const MAX = 57402
const MAX_OVER_TIME = 57412
const MIN = 57403
const MIN_OVER_TIME = 57411
const MOD = 57449
const MUL = 57447
const NAME = 57371
const NEQ = 57425
const NESTEDSETLEFT = 57380
const NESTEDSETPARENT = 57382
const NESTEDSETRIGHT = 57381
const NIL = 57357
const NOT = 57446
const NOT_ANCE = 57438
const NOT_CHILD = 57435
const NOT_DESC = 57437
const NOT_PARENT = 57436
const NRE = 57430
const OPEN_BRACE = 57352
const OPEN_PARENS = 57354
const OR = 57423
const PARENT = 57374
const PARENT_DOT = 57389
const PARENT_ID = 57386
const PIPE = 57421
const POW = 57450
const QUANTILE_OVER_TIME = 57415
const RATE = 57409
const RE = 57431
const RESOURCE_DOT = 57390
const ROOTNAME = 57376
const ROOTSERVICE = 57378
const ROOTSERVICENAME = 57377
const SELECT = 57407
const SIBL = 57434
const SPAN_COLON = 57393
const SPAN_DOT = 57391
const SPAN_ID = 57385
const STATUS = 57372
const STATUS_ERROR = 57360
const STATUS_MESSAGE = 57373
const STATUS_OK = 57361
const STATUS_UNSET = 57362
const STRING = 57347
const SUB = 57445
const SUM = 57404
const SUM_OVER_TIME = 57414
const TIMESINCESTART = 57387
const TOPK = 57418
const TRACEDURATION = 57379
const TRACE_COLON = 57392
const TRACE_ID = 57384
const TRUE = 57358
const TimestampNever = uint32(math.MaxUint32)
const UNION_ANCE = 57442
const UNION_CHILD = 57439
const UNION_DESC = 57441
const UNION_PARENT = 57440
const UNION_SIBL = 57443
const VERSION = 57388
const WITH = 57420
Variables ¶
var ( IntrinsicDurationAttribute = NewIntrinsic(IntrinsicDuration) IntrinsicNameAttribute = NewIntrinsic(IntrinsicName) IntrinsicStatusAttribute = NewIntrinsic(IntrinsicStatus) IntrinsicStatusMessageAttribute = NewIntrinsic(IntrinsicStatusMessage) IntrinsicKindAttribute = NewIntrinsic(IntrinsicKind) IntrinsicSpanIDAttribute = NewIntrinsic(IntrinsicSpanID) IntrinsicParentIDAttribute = NewIntrinsic(IntrinsicParentID) IntrinsicChildCountAttribute = NewIntrinsic(IntrinsicChildCount) IntrinsicTraceIDAttribute = NewIntrinsic(IntrinsicTraceID) IntrinsicTraceRootServiceAttribute = NewIntrinsic(IntrinsicTraceRootService) IntrinsicTraceRootSpanAttribute = NewIntrinsic(IntrinsicTraceRootSpan) IntrinsicTraceDurationAttribute = NewIntrinsic(IntrinsicTraceDuration) IntrinsicSpanStartTimeAttribute = NewIntrinsic(IntrinsicSpanStartTime) IntrinsicNestedSetLeftAttribute = NewIntrinsic(IntrinsicNestedSetLeft) IntrinsicNestedSetRightAttribute = NewIntrinsic(IntrinsicNestedSetRight) IntrinsicNestedSetParentAttribute = NewIntrinsic(IntrinsicNestedSetParent) IntrinsicLinkTraceIDAttribute = NewIntrinsic(IntrinsicLinkTraceID) IntrinsicLinkSpanIDAttribute = NewIntrinsic(IntrinsicLinkSpanID) IntrinsicEventNameAttribute = NewIntrinsic(IntrinsicEventName) IntrinsicEventTimeSinceStartAttribute = NewIntrinsic(IntrinsicEventTimeSinceStart) IntrinsicInstrumentationNameAttribute = NewIntrinsic(IntrinsicInstrumentationName) IntrinsicInstrumentationVersionAttribute = NewIntrinsic(IntrinsicInstrumentationVersion) )
var ( StaticNil = NewStaticNil() StaticTrue = NewStaticBool(true) StaticFalse = NewStaticBool(false) )
var ErrMathNotSupported = errors.New("math expressions not supported")
var ErrMaxConditionGroupsPerTagQueryReached = errors.New("maximum condition groups reached")
ErrMaxConditionGroupsPerTagQueryReached is returned when OR expansion exceeds the configured limit. Use errors.Is to check for this error; the message includes the configured limit for operator visibility.
Functions ¶
func AlignEndToLeft ¶
func AlignEndToLeft(req *tempopb.QueryRangeRequest)
func AlignRequest ¶
func AlignRequest(req *tempopb.QueryRangeRequest)
AlignRequest shifts the start and end times of the request to align with the step interval. This gives more consistent results across refreshes of queries like "last 1 hour". Without alignment each refresh is shifted by seconds or even milliseconds and the time series calculations are sublty different each time. It's not wrong, but less preferred behavior.
func Compile ¶
func Compile(query string, opts ...CompileOption) (*RootExpr, Pipeline, SpansetFilterFunc, *FetchSpansRequest, error)
Compile parses and compiles a TraceQL query. Options specific to metrics queries are ignored. It does not support math expressions.
func DefaultQueryRangeStep ¶
func ExtractConditionGroups ¶
ExtractConditionGroups parses a query string using the lenient parser and returns groups of conditions. Conditions with OpNone (from incomplete matchers) are filtered out.
Returns nil if the query is empty or parsing fails completely. Returns nil, ErrMaxConditionGroupsPerTagQueryReached if the number of groups exceeds maxGroups.
func IsEmptyQuery ¶
IsEmptyQuery returns true if the query is empty or a match-all (e.g. "{}", "{ }", "{ true }").
func IsInstant ¶
func IsInstant(req *tempopb.QueryRangeRequest) bool
IsInstant returns true if the request is an instant query. It relies on the instant flag. If the flag is not provided, it falls back on determining by step and range. The fallback logic is to provide consistent results during rollout of the instant flag and will be removed in a future release.
func IsValidTransformationName ¶
IsValidTransformationName reports whether name is a known transformation name or "all".
func KnownTransformationNames ¶
func KnownTransformationNames() []string
KnownTransformationNames returns a comma-separated list of valid transformation names.
func Log2Bucketize ¶
Log2Bucketize rounds the given value to the next powers-of-two bucket.
func Log2Quantile ¶
func Log2Quantile(p float64, buckets []HistogramBucket) float64
Log2Quantile returns the quantile given bucket labeled with float ranges and counts. Uses exponential power-of-two interpolation between buckets as needed.
func Log2QuantileWithBucket ¶
func Log2QuantileWithBucket(p float64, buckets []HistogramBucket) (float64, int)
Log2QuantileWithBucket returns both the quantile value and the bucket index where the quantile falls. This avoids rescanning buckets when you need to determine which bucket contains a specific value.
func MakeCollectTagValueFunc ¶
func NeedsFullTrace ¶
func NormalizeQuery ¶
NormalizeQuery parses a query string using the lenient parser and returns a normalized string representation. Used for cache key generation. Match-all queries (e.g. "{}", "{ }", "{ true }") are normalized to "{}" to avoid cache fragmentation.
func TrimToAfter ¶
func TrimToAfter(req *tempopb.QueryRangeRequest, before time.Time)
TrimToAfter shortens the query window to only include after the given time. Request must be in unix nanoseconds already.
func TrimToBefore ¶
func TrimToBefore(req *tempopb.QueryRangeRequest, before time.Time)
TrimToBefore shortens the query window to only include before the given time. Request must be in unix nanoseconds already.
func TrimToBlockOverlap ¶
func TrimToBlockOverlap(req *tempopb.QueryRangeRequest, blockStart, blockEnd time.Time) (uint64, uint64, uint64)
TrimToBlockOverlap returns the overlap between the given time range and block. It is used to split a block to only the portion overlapping, or when the entire block is within range then opportunistically remove time slots that are known to be unused. When possible and not exceeding the request range, borders are aligned to the step. When a block is split then the borders will maintain the nanosecond precision of the request.
Types ¶
type ASTRewriter ¶
ASTRewriter modifies a TraceQL AST without changing its meaning.
type AggregateMode ¶
type AggregateMode int
AggregateMode is the different flavors of metrics queries as executed in different places.
type AggregateOp ¶
type AggregateOp int
func (AggregateOp) String ¶
func (a AggregateOp) String() string
type Attribute ¶
type Attribute struct {
Name string // 16 bytes
Scope AttributeScope // 1 byte - aligned with other fields
Parent bool // 1 byte - aligned with other fields
Intrinsic Intrinsic // 1 byte - aligned with other fields
}
func MustParseIdentifier ¶
func NewAttribute ¶
NewAttribute creates a new attribute with the given identifier string.
func NewIntrinsic ¶
func NewScopedAttribute ¶
func NewScopedAttribute(scope AttributeScope, parent bool, att string) Attribute
NewScopedAttribute creates a new scopedattribute with the given identifier string. this handles parent, span, and resource scopes.
func ParseIdentifier ¶
warning: ParseIdentifier is used to parse filter policies in pkg/spanfilter/config/config.go if changed, it can break existing config.
Behavioral note vs. the previous implementation: this now rejects identifiers containing unquoted spaces (e.g. ".foo bar") that were previously accepted via HasPrefix matching. Quoted identifiers with spaces (e.g. span."foo bar") are still accepted.
type AttributeScope ¶
type AttributeScope int8
const ( AttributeScopeNone AttributeScope = iota AttributeScopeTrace AttributeScopeResource AttributeScopeSpan AttributeScopeEvent AttributeScopeLink AttributeScopeInstrumentation AttributeScopeUnknown )
func AllAttributeScopes ¶
func AllAttributeScopes() []AttributeScope
func AttributeScopeFromString ¶
func AttributeScopeFromString(s string) AttributeScope
func (AttributeScope) String ¶
func (s AttributeScope) String() string
type BaselineAggregator ¶
type BaselineAggregator struct {
// contains filtered or unexported fields
}
BaselineAggregator is a special series combiner for the compare() function. It resplits job-level results into baseline and selection buffers, and if an attribute reached max cardinality at the job-level, it will be marked as such at the query-level.
func NewBaselineAggregator ¶
func NewBaselineAggregator(req *tempopb.QueryRangeRequest, topN int, exemplars uint32) *BaselineAggregator
func (*BaselineAggregator) Combine ¶
func (b *BaselineAggregator) Combine(ss []*tempopb.TimeSeries)
func (*BaselineAggregator) Length ¶
func (b *BaselineAggregator) Length() int
func (*BaselineAggregator) Results ¶
func (b *BaselineAggregator) Results() SeriesSet
type BinaryOperation ¶
type BinaryOperation struct {
Op Operator
LHS FieldExpression
RHS FieldExpression
// contains filtered or unexported fields
}
func (*BinaryOperation) String ¶
func (o *BinaryOperation) String() string
type ChainedSecondStage ¶
type ChainedSecondStage []secondStageElement
ChainedSecondStage chains multiple second stage elements together. Elements are processed in order, each receiving the output of the previous. Example: {status=error} | rate() | topk(5) > 10
func (ChainedSecondStage) String ¶
func (c ChainedSecondStage) String() string
type CoalesceOperation ¶
type CoalesceOperation struct{}
func (CoalesceOperation) String ¶
func (o CoalesceOperation) String() string
type CommonIterator ¶
type CompileOption ¶
type CompileOption func(*compileOptions)
CompileOption is a functional option for Parse, Compile, Engine.CompileMetricsQueryRange, and Engine.CompileMetricsQueryRangeNonRaw. Parse and Compile silently ignore options specific to metrics queries like WithSpanOnlyFetch and WithTimeOverlapCutoff.
func WithSkipOptimization ¶
func WithSkipOptimization(name string) CompileOption
WithSkipOptimization adds name to the list of AST transformations to skip during parsing. Use TransformationAll to skip all transformations.
func WithSpanOnlyFetch ¶
func WithSpanOnlyFetch(v bool) CompileOption
WithSpanOnlyFetch sets whether to use the span-only fetch path. When not set the default is used, and this may be overridden by the query hint.
func WithTimeOverlapCutoff ¶
func WithTimeOverlapCutoff(v float64) CompileOption
WithTimeOverlapCutoff sets the overlap threshold (0 to 1) for trace-level timestamp filtering. When not set the default value is used.
func WithUnsafeHints ¶
func WithUnsafeHints(v bool) CompileOption
WithUnsafeHints controls whether the unsafe query hint HintSkipASTTransformations is honored during parsing. This does not affect other unsafe hints, which are read after parsing by the caller.
type Condition ¶
type Condition struct {
Attribute Attribute
Op Operator
Operands Operands
// Callback is used in the parquetquery.CallbackPredicate to determine if the iterator should be stopped.
// It's used to limit the overhead of fetching exemplars by stopping the iterator early.
CallBack func() bool
// Hints
Precision time.Duration
}
func ExemplarMetaConditions ¶
func SearchMetaConditions ¶
func SearchMetaConditions() []Condition
type CountOverTimeAggregator ¶
type CountOverTimeAggregator struct {
// contains filtered or unexported fields
}
CountOverTimeAggregator counts the number of spans. It can also calculate the rate when given a multiplier. TODO - Rewrite me to be []float64 which is more efficient
func NewCountOverTimeAggregator ¶
func NewCountOverTimeAggregator() *CountOverTimeAggregator
func NewRateAggregator ¶
func NewRateAggregator(rateMult float64) *CountOverTimeAggregator
func (*CountOverTimeAggregator) Observe ¶
func (c *CountOverTimeAggregator) Observe(_ Span)
func (*CountOverTimeAggregator) Sample ¶
func (c *CountOverTimeAggregator) Sample() float64
type Engine ¶
type Engine struct{}
func (*Engine) CompileMetricsQueryRange ¶
func (e *Engine) CompileMetricsQueryRange(req *tempopb.QueryRangeRequest, opts ...CompileOption) (MetricsEvaluator, error)
CompileMetricsQueryRange returns an evaluator that can be reused across multiple data sources.
func (*Engine) CompileMetricsQueryRangeNonRaw ¶
func (e *Engine) CompileMetricsQueryRangeNonRaw(req *tempopb.QueryRangeRequest, mode AggregateMode, opts ...CompileOption) (*MetricsFrontendEvaluator, error)
func (*Engine) ExecuteSearch ¶
func (e *Engine) ExecuteSearch(ctx context.Context, searchReq *tempopb.SearchRequest, fetcher SpansetFetcher, opts ...CompileOption) (*tempopb.SearchResponse, error)
ExecuteSearch executes a search query. Options control AST optimization and hint behavior.
func (*Engine) ExecuteTagNames ¶
func (e *Engine) ExecuteTagNames( ctx context.Context, scope AttributeScope, conditionGroups [][]Condition, cb FetchTagsCallback, fetcher TagNamesFetcher, ) error
func (*Engine) ExecuteTagValues ¶
func (e *Engine) ExecuteTagValues( ctx context.Context, tag Attribute, conditionGroups [][]Condition, cb FetchTagValuesCallback, fetcher TagValuesFetcher, maxConditionGroups int, ) error
type FastStatic ¶
type FastStatic interface {
FastStatic1 | FastStatic2 | FastStatic3 | FastStatic4 | FastStatic5
}
type FastStatic1 ¶
type FastStatic1 [1]StaticMapKey
type FastStatic2 ¶
type FastStatic2 [2]StaticMapKey
type FastStatic3 ¶
type FastStatic3 [3]StaticMapKey
type FastStatic4 ¶
type FastStatic4 [4]StaticMapKey
type FastStatic5 ¶
type FastStatic5 [5]StaticMapKey
type FetchSpansOnlyResponse ¶
type FetchSpansOnlyResponse struct {
Results SpanIterator
// callback to get the size of data read during Fetch
Bytes func() uint64
}
type FetchSpansRequest ¶
type FetchSpansRequest struct {
StartTimeUnixNanos uint64
EndTimeUnixNanos uint64
Conditions []Condition
// By default, the storage layer fetches spans meeting any of the criteria.
// This hint is for common cases like { x && y && z } where the storage layer
// can make extra optimizations by returning only spansets that meet
// all criteria.
AllConditions bool
// Sampling
// There are two methods of sampling: trace-level samples a subset of traces,
// either skipping them or returning them in full. Span-level samples a
// subset of spans within each trace, still returning a spanset for each
// matching trace. Only one will be applied at a time. These fields are
// optional and there is no negative effect on the results if they are not
// honored at the storage layer.
TraceSampler Sampler
SpanSampler Sampler
// SecondPassFn and Conditions allow a caller to retrieve one set of data
// in the first pass, filter using the SecondPassFn callback and then
// request a different set of data in the second pass. This is particularly
// useful for retrieving data required to resolve a TraceQL query in the first
// pass and only selecting metadata in the second pass.
// TODO: extend this to an arbitrary number of passes
SecondPass SecondPassFn
SecondPassConditions []Condition
SecondPassSelectAll bool // Ignore second pass conditions and select all attributes
}
func ExtractFetchSpansRequest ¶
func ExtractFetchSpansRequest(query string) (FetchSpansRequest, error)
ExtractFetchSpansRequest parses the given traceql query and returns the storage layer conditions. Returns an error if the query fails to parse.
func MustExtractFetchSpansRequestWithMetadata ¶
func MustExtractFetchSpansRequestWithMetadata(query string) FetchSpansRequest
MustExtractFetchSpansRequestWithMetadata parses the given traceql query and returns the storage layer conditions. Panics if the query fails to parse.
func (*FetchSpansRequest) HasAttribute ¶
func (f *FetchSpansRequest) HasAttribute(a Attribute) bool
func (*FetchSpansRequest) HasAttributeWithOp ¶
func (f *FetchSpansRequest) HasAttributeWithOp(a Attribute, o Operator) bool
func (*FetchSpansRequest) SecondPassHasAttribute ¶
func (f *FetchSpansRequest) SecondPassHasAttribute(a Attribute) bool
type FetchSpansResponse ¶
type FetchSpansResponse struct {
Results SpansetIterator
// callback to get the size of data read during Fetch
Bytes func() uint64
}
type FetchTagValuesCallback ¶
FetchTagValuesCallback is called to collect unique tag values. Returns true if it has exceeded the maximum number of results.
type FetchTagValuesRequest ¶
type FetchTagsCallback ¶
type FetchTagsCallback func(tag string, scope AttributeScope) bool
type FetchTagsRequest ¶
type FetchTagsRequest struct {
ConditionGroups [][]Condition
Scope AttributeScope
}
type FieldExpression ¶
type FieldExpression interface {
Element
// contains filtered or unexported methods
}
********************** Expressions **********************
type GroupOperation ¶
type GroupOperation struct {
Expression FieldExpression
// contains filtered or unexported fields
}
func (GroupOperation) String ¶
func (o GroupOperation) String() string
type GroupingAggregator ¶
type GroupingAggregator[F FastStatic, S StaticVals] struct { // contains filtered or unexported fields }
GroupingAggregator groups spans into series based on attribute values.
func (*GroupingAggregator[F, S]) Length ¶
func (g *GroupingAggregator[F, S]) Length() int
func (*GroupingAggregator[F, S]) Observe ¶
func (g *GroupingAggregator[F, S]) Observe(span Span)
Observe the span by looking up its group-by attributes, mapping to the series, and passing to the inner aggregate. This is a critical hot path.
func (*GroupingAggregator[F, S]) ObserveExemplar ¶
func (g *GroupingAggregator[F, S]) ObserveExemplar(span Span, value float64, ts uint64)
func (*GroupingAggregator[F, S]) Series ¶
func (g *GroupingAggregator[F, S]) Series() SeriesSet
type Hints ¶
type Hints struct {
Hints []*Hint
}
func (*Hints) GetDuration ¶
func (*Hints) GetStringSlice ¶
type Histogram ¶
type Histogram struct {
Buckets []HistogramBucket
}
type HistogramAggregator ¶
type HistogramAggregator struct {
// contains filtered or unexported fields
}
func NewHistogramAggregator ¶
func NewHistogramAggregator(req *tempopb.QueryRangeRequest, qs []float64, exemplarLimit uint32) *HistogramAggregator
func (*HistogramAggregator) Combine ¶
func (h *HistogramAggregator) Combine(in []*tempopb.TimeSeries)
func (*HistogramAggregator) Length ¶
func (h *HistogramAggregator) Length() int
func (*HistogramAggregator) Results ¶
func (h *HistogramAggregator) Results() SeriesSet
type HistogramBucket ¶
type InstantAggregator ¶
type InstantAggregator struct {
// contains filtered or unexported fields
}
InstantAggregator is similar to StepAggregator but always has only one interval. It's used for instant queries where we only need a single data point.
func NewInstantAggregator ¶
func NewInstantAggregator(start, end uint64, innerAgg func() VectorAggregator) *InstantAggregator
func (*InstantAggregator) Exemplars ¶
func (i *InstantAggregator) Exemplars() []Exemplar
func (*InstantAggregator) Length ¶
func (i *InstantAggregator) Length() int
func (*InstantAggregator) Observe ¶
func (i *InstantAggregator) Observe(span Span)
func (*InstantAggregator) ObserveExemplar ¶
func (i *InstantAggregator) ObserveExemplar(float64, uint64, Labels)
func (*InstantAggregator) Samples ¶
func (i *InstantAggregator) Samples() []float64
type IntervalMapper ¶
type IntervalMapper interface {
// Interval the given timestamp within the range and step.
Interval(ts uint64) int
// IntervalMs is the same as Bucket except the input and calculations are in unix milliseconds.
IntervalMs(ts int64) int
TimestampOf(interval int) uint64
// IntervalCount is the number of intervals in the range with step.
IntervalCount() int
}
func NewIntervalMapper ¶
func NewIntervalMapper(start, end, step uint64, instant bool) IntervalMapper
func NewIntervalMapperFromReq ¶
func NewIntervalMapperFromReq(req *tempopb.QueryRangeRequest) IntervalMapper
type IntervalMapperInstant ¶
type IntervalMapperInstant struct {
// contains filtered or unexported fields
}
func (IntervalMapperInstant) Interval ¶
func (i IntervalMapperInstant) Interval(ts uint64) int
func (IntervalMapperInstant) IntervalCount ¶
func (i IntervalMapperInstant) IntervalCount() int
func (IntervalMapperInstant) IntervalMs ¶
func (i IntervalMapperInstant) IntervalMs(tsmill int64) int
func (IntervalMapperInstant) TimestampOf ¶
func (i IntervalMapperInstant) TimestampOf(int) uint64
type IntervalMapperQueryRange ¶
type IntervalMapperQueryRange struct {
// contains filtered or unexported fields
}
func (IntervalMapperQueryRange) Interval ¶
func (i IntervalMapperQueryRange) Interval(ts uint64) int
func (IntervalMapperQueryRange) IntervalCount ¶
func (i IntervalMapperQueryRange) IntervalCount() int
func (IntervalMapperQueryRange) IntervalMs ¶
func (i IntervalMapperQueryRange) IntervalMs(tsmill int64) int
func (IntervalMapperQueryRange) TimestampOf ¶
func (i IntervalMapperQueryRange) TimestampOf(interval int) uint64
type Intrinsic ¶
type Intrinsic int8
const ( IntrinsicNone Intrinsic = iota IntrinsicDuration IntrinsicName IntrinsicStatus IntrinsicStatusMessage IntrinsicKind IntrinsicChildCount IntrinsicTraceRootService IntrinsicTraceRootSpan IntrinsicTraceDuration IntrinsicNestedSetLeft IntrinsicNestedSetRight IntrinsicNestedSetParent IntrinsicEventName IntrinsicEventTimeSinceStart IntrinsicLinkSpanID IntrinsicLinkTraceID IntrinsicInstrumentationName IntrinsicInstrumentationVersion // not yet implemented in traceql but will be IntrinsicParent // These intrinsics do not map to specific data points, but are used to // indicate that Spans must be able to answer the structural methods // DescdendantOf, SiblingOf and ChildOf. The details of those methods // and how these intrinsics are handled is left to the implementation. IntrinsicStructuralDescendant IntrinsicStructuralSibling IntrinsicStructuralChild IntrinsicTraceID IntrinsicSpanID IntrinsicParentID ScopedIntrinsicSpanStatus ScopedIntrinsicSpanStatusMessage ScopedIntrinsicSpanDuration ScopedIntrinsicSpanName ScopedIntrinsicSpanKind ScopedIntrinsicTraceRootName ScopedIntrinsicTraceRootService ScopedIntrinsicTraceDuration IntrinsicTraceStartTime IntrinsicSpanStartTime IntrinsicServiceStats )
keep the intrinsics in sync with GetVirtualIntrinsicValues() in pkg/search/util.go
type Labels ¶
type Labels []Label
func LabelsFromArgs ¶
func LabelsFromProto ¶
func LabelsFromProto(ls []commonv1proto.KeyValue) Labels
func (Labels) MapKey ¶
func (ls Labels) MapKey() SeriesMapKey
type MetadataCombiner ¶
type MetadataCombiner interface {
AddMetadata(*tempopb.TraceSearchMetadata) bool
IsCompleteFor(ts uint32) bool
Metadata() []*tempopb.TraceSearchMetadata
MetadataAfter(ts uint32) []*tempopb.TraceSearchMetadata
// contains filtered or unexported methods
}
func NewMetadataCombiner ¶
func NewMetadataCombiner(limit int, keepMostRecent bool) MetadataCombiner
type MetricsAggregate ¶
type MetricsAggregate struct {
// contains filtered or unexported fields
}
MetricsAggregate is a placeholder in the AST for a metrics aggregation pipeline element. It has a superset of the properties of them all, and builds them later via init() so that appropriate buffers can be allocated for the query time range and step, and different implementations for shardable and unshardable pipelines.
func (MetricsAggregate) String ¶
func (a MetricsAggregate) String() string
type MetricsAggregateOp ¶
type MetricsAggregateOp int
func (MetricsAggregateOp) String ¶
func (a MetricsAggregateOp) String() string
type MetricsCompare ¶
type MetricsCompare struct {
// contains filtered or unexported fields
}
func (*MetricsCompare) String ¶
func (m *MetricsCompare) String() string
type MetricsEvaluator ¶
type MetricsFilter ¶
type MetricsFilter struct {
// contains filtered or unexported fields
}
MetricsFilter implements second stage comparison filtering on metrics results. It filters data points that don't match the comparison condition, setting them to NaN. Series with all NaN values after filtering are removed. Example: {status=error} | rate() by (svc) > 10
func (*MetricsFilter) String ¶
func (m *MetricsFilter) String() string
type MetricsFrontendEvaluator ¶
type MetricsFrontendEvaluator struct {
// contains filtered or unexported fields
}
MetricsFrontendEvaluator pipes the sharded job results back into the engine for the rest of the pipeline. Works uniformly for math and non-math queries.
func (*MetricsFrontendEvaluator) Length ¶
func (m *MetricsFrontendEvaluator) Length() int
func (*MetricsFrontendEvaluator) ObserveSeries ¶
func (m *MetricsFrontendEvaluator) ObserveSeries(in []*tempopb.TimeSeries)
func (*MetricsFrontendEvaluator) Results ¶
func (m *MetricsFrontendEvaluator) Results() SeriesSet
type Operator ¶
type Operator int
const ( OpNone Operator = iota OpAdd OpSub OpDiv OpMod OpMult OpEqual OpNotEqual OpRegex OpNotRegex OpGreater OpGreaterEqual OpLess OpLessEqual OpPower OpAnd OpOr OpNot OpSpansetChild OpSpansetParent OpSpansetDescendant OpSpansetAncestor OpSpansetAnd OpSpansetUnion OpSpansetSibling OpSpansetNotChild OpSpansetNotParent OpSpansetNotSibling OpSpansetNotAncestor OpSpansetNotDescendant OpSpansetUnionChild OpSpansetUnionParent OpSpansetUnionSibling OpSpansetUnionAncestor OpSpansetUnionDescendant // The following operators are used internally and only exist in the AST. They are not parseable in TraceQL OpExists OpNotExists OpIn OpNotIn OpRegexMatchAny OpRegexMatchNone )
type OverTimeAggregator ¶
type OverTimeAggregator struct {
// contains filtered or unexported fields
}
MinOverTimeAggregator it calculates the mininum value over time. It can also calculate the rate when given a multiplier.
func NewOverTimeAggregator ¶
func NewOverTimeAggregator(attr Attribute, op SimpleAggregationOp) *OverTimeAggregator
func (*OverTimeAggregator) Observe ¶
func (c *OverTimeAggregator) Observe(s Span)
func (*OverTimeAggregator) Sample ¶
func (c *OverTimeAggregator) Sample() float64
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
ParseError is what is returned when we failed to parse.
func (*ParseError) Error ¶
func (p *ParseError) Error() string
type Pipeline ¶
type Pipeline struct {
Elements []PipelineElement
}
type PipelineElement ¶
type PipelineElement interface {
Element
// contains filtered or unexported methods
}
type QueryRangeCombiner ¶
type QueryRangeCombiner struct {
// contains filtered or unexported fields
}
func QueryRangeCombinerFor ¶
func QueryRangeCombinerFor(req *tempopb.QueryRangeRequest, mode AggregateMode, maxSeriesLimit int) (*QueryRangeCombiner, error)
func (*QueryRangeCombiner) Combine ¶
func (q *QueryRangeCombiner) Combine(resp *tempopb.QueryRangeResponse)
func (*QueryRangeCombiner) MaxSeriesReached ¶
func (q *QueryRangeCombiner) MaxSeriesReached() bool
func (*QueryRangeCombiner) Response ¶
func (q *QueryRangeCombiner) Response() *tempopb.QueryRangeResponse
type RangeAggregator ¶
type RangeAggregator interface {
Observe(s Span)
ObserveExemplar(float64, uint64, Labels)
Samples() []float64
Exemplars() []Exemplar
Length() int
}
RangeAggregator sorts spans into time slots TODO - for efficiency we probably combine this with VectorAggregator (see todo about CountOverTimeAggregator)
type RootExpr ¶
type RootExpr struct {
Pipeline map[string]Pipeline // spanset filters
BatchSpanProcessor map[string]spanProcessor // span processing
SeriesProcessor map[string]seriesProcessor // time series processing
Hints *Hints
OptimizationCount int
// contains filtered or unexported fields
}
func ApplyASTRewrites ¶
ApplyASTRewrites applies all registered transformations except those whose names appear in skip. Passing TransformationAll in skip disables every transformation.
func CompileFetchSpanRequests ¶
func CompileFetchSpanRequests(query string, opts ...CompileOption) (*RootExpr, map[string]FetchSpansRequest, error)
CompileFetchSpanRequests parses a query and returns per-sub-query FetchSpansRequests. This supports both plain spanset queries and math expressions (multiple sub-queries).
func Parse ¶
func Parse(s string, opts ...CompileOption) (expr *RootExpr, err error)
Parse parses a TraceQL query string and applies AST transformations according to opts. Options specific to metrics queries (e.g. WithSpanOnlyFetch) are ignored here.
func ParseLenient ¶
ParseLenient attempts to parse a query string. If parsing succeeds, the result is returned as-is. If parsing fails (e.g. due to incomplete matchers like `.foo=`), it removes the comparison operator from incomplete matchers, leaving just the attribute (e.g. `.foo`), while preserving the original query structure (ORs, ANDs, pipes, structural operators, etc.) and re-parses the cleaned-up query.
func ParseNoOptimizations ¶
ParseNoOptimizations parses a TraceQL query without applying any AST transformations. Use for contexts where only hints or query structure are inspected and not executed, like hint extraction, validation, etc.
func (*RootExpr) IsNoop ¶
IsNoop detects trivial noop queries like {false} which never return results and can be used to exit early.
func (*RootExpr) MetricsSecondStage ¶
func (r *RootExpr) MetricsSecondStage() secondStageElement
func (*RootExpr) SinglePipeline ¶
SinglePipeline returns the pipeline when there is exactly one sub-query. Returns false for math expressions (multiple pipelines).
type Sampler ¶
type Sampler interface {
// Sample is called on every entry. If this returns true the entry should
// be inspected further. If this returns false then the entry should be skipped.
Sample() bool
// Measured is called on matching data coming into the TraceQL engine.
// This is how samplers gain knowledge of the actual proportion of data matching the query.
Measured()
// Expect is called before any sampling and provides knowledge of the total number of entries
// that are present in the dataset. This allows the sampler to alter behavior if needed.
Expect(count uint64)
// FinalScalingFactor is called at the end to and is how much to scale up the
// results.
FinalScalingFactor() float64
}
type ScalarExpression ¶
type ScalarExpression interface {
// PipelineElement
Element
// contains filtered or unexported methods
}
********************** Scalars **********************
type ScalarFilter ¶
type ScalarFilter struct {
Op Operator
LHS ScalarExpression
RHS ScalarExpression
}
func (ScalarFilter) String ¶
func (f ScalarFilter) String() string
type ScalarOperation ¶
type ScalarOperation struct {
Op Operator
LHS ScalarExpression
RHS ScalarExpression
}
func (ScalarOperation) String ¶
func (o ScalarOperation) String() string
type SecondPassFn ¶
SecondPassFn is a method that is called in between the first and second pass of a fetch spans request. See below.
type SecondStageOp ¶
type SecondStageOp int
const ( OpTopK SecondStageOp = iota OpBottomK )
func (SecondStageOp) String ¶
func (op SecondStageOp) String() string
type SelectOperation ¶
type SelectOperation struct {
// contains filtered or unexported fields
}
func (SelectOperation) String ¶
func (o SelectOperation) String() string
type SeriesAggregator ¶
type SeriesAggregator interface {
Combine([]*tempopb.TimeSeries)
Results() SeriesSet
Length() int
}
type SeriesMapKey ¶
type SeriesMapKey [maxGroupBys]SeriesMapLabel
type SeriesMapLabel ¶
type SeriesMapLabel struct {
Name string
Value StaticMapKey
}
type SeriesSet ¶
type SeriesSet map[SeriesMapKey]TimeSeries
SeriesSet is a set of unique timeseries. They are mapped by the "Prometheus"-style text description: {x="a",y="b"} for convenience.
func (SeriesSet) ToProto ¶
func (set SeriesSet) ToProto(req *tempopb.QueryRangeRequest) []*tempopb.TimeSeries
type ServiceStats ¶
type SimpleAggregationOp ¶
type SimpleAggregationOp int
type SimpleAggregator ¶
type SimpleAggregator struct {
// contains filtered or unexported fields
}
func NewSimpleCombiner ¶
func NewSimpleCombiner(req *tempopb.QueryRangeRequest, op SimpleAggregationOp) *SimpleAggregator
func (*SimpleAggregator) Combine ¶
func (b *SimpleAggregator) Combine(in []*tempopb.TimeSeries)
func (*SimpleAggregator) Length ¶
func (b *SimpleAggregator) Length() int
func (*SimpleAggregator) Results ¶
func (b *SimpleAggregator) Results() SeriesSet
type Span ¶
type Span interface {
// AttributeFor returns the attribute for the given key. If the attribute is not found then
// the second return value will be false.
AttributeFor(Attribute) (Static, bool)
// AllAttributes returns a map of all attributes for this span. AllAttributes should be used sparingly
// and is expected to be significantly slower than AttributeFor.
AllAttributes() map[Attribute]Static
// AllAttributesFunc is a way to access all attributes for this span, letting the span determine the
// optimal method. Avoids allocating a map like AllAttributes.
AllAttributesFunc(func(Attribute, Static))
ID() []byte
StartTimeUnixNanos() uint64
DurationNanos() uint64
// SiblingOf returns all spans on the RHS side that have siblings in the LHS. If falseForAll is true
// then the returned spans will be those that do not have siblings in the LHS. buffer is an optional
// buffer to use to avoid allocations.
SiblingOf(lhs []Span, rhs []Span, falseForAll bool, union bool, buffer []Span) []Span
// DescendantOf returns all spans on the RHS side that have descendants in the LHS. If falseForAll is true
// then the returned spans will be those that do not have descendants in the LHS. invert is used to invert
// the relationship. If invert is true then this will behave like "AncestorOf". buffer is an optional
// buffer to use to avoid allocations.
DescendantOf(lhs []Span, rhs []Span, falseForAll bool, invert bool, union bool, buffer []Span) []Span
// ChildOf returns all spans on the RHS side that have children in the LHS. If falseForAll is true
// then the returned spans will be those that do not have children in the LHS. invert is used to invert
// the relationship. If invert is true then this will behave like "ParentOf". buffer is an optional
// buffer to use to avoid allocations.
ChildOf(lhs []Span, rhs []Span, falseForAll bool, invert bool, union bool, buffer []Span) []Span
}
type SpanAggregator ¶
type SpanAggregator interface {
Observe(Span)
ObserveExemplar(Span, float64, uint64)
Series() SeriesSet
Length() int
}
SpanAggregator sorts spans into series
func NewGroupingAggregator ¶
func NewGroupingAggregator(aggName string, innerAgg func() RangeAggregator, by []Attribute, byFunc func(Span) (Static, bool), byFuncLabel string) SpanAggregator
type SpanIterator ¶
type SpanIterator interface {
CommonIterator[Span]
}
type Spanset ¶
type Spanset struct {
// these fields are actually used by the engine to evaluate queries
Scalar Static
Spans []Span
TraceID []byte
RootSpanName string
RootServiceName string
StartTimeUnixNanos uint64
DurationNanos uint64
ServiceStats map[string]ServiceStats
Attributes []*SpansetAttribute
// Set this function to provide upstream callers with a method to
// release this spanset and all its spans when finished. This method will be
// called with the spanset itself as the argument. This is done for a worthwhile
// memory savings as the same function pointer can then be reused across spansets.
ReleaseFn func(*Spanset)
}
func (*Spanset) AddAttribute ¶
type SpansetAttribute ¶
type SpansetExpression ¶
type SpansetExpression interface {
PipelineElement
// contains filtered or unexported methods
}
********************** Spansets **********************
type SpansetFetcher ¶
type SpansetFetcher interface {
Fetch(context.Context, FetchSpansRequest) (FetchSpansResponse, error)
FetchSpans(context.Context, FetchSpansRequest) (FetchSpansOnlyResponse, error)
}
func NewSpansetFetcherWrapper ¶
func NewSpansetFetcherWrapper(fetchSpanSetsFn func(ctx context.Context, req FetchSpansRequest) (FetchSpansResponse, error)) SpansetFetcher
func NewSpansetFetcherWrapperBoth ¶
func NewSpansetFetcherWrapperBoth( fetchSpanSetsFn func(ctx context.Context, req FetchSpansRequest) (FetchSpansResponse, error), fetchSpansFn func(ctx context.Context, req FetchSpansRequest) (FetchSpansOnlyResponse, error), ) SpansetFetcher
type SpansetFetcherWrapper ¶
type SpansetFetcherWrapper struct {
// contains filtered or unexported fields
}
func (SpansetFetcherWrapper) Fetch ¶
func (s SpansetFetcherWrapper) Fetch(ctx context.Context, request FetchSpansRequest) (FetchSpansResponse, error)
func (SpansetFetcherWrapper) FetchSpans ¶
func (s SpansetFetcherWrapper) FetchSpans(ctx context.Context, request FetchSpansRequest) (FetchSpansOnlyResponse, error)
type SpansetFilter ¶
type SpansetFilter struct {
Expression FieldExpression
// contains filtered or unexported fields
}
func (SpansetFilter) String ¶
func (f SpansetFilter) String() string
type SpansetFilterFunc ¶
type SpansetIterator ¶
type SpansetIterator interface {
CommonIterator[*Spanset]
}
type SpansetOperation ¶
type SpansetOperation struct {
Op Operator
LHS SpansetExpression
RHS SpansetExpression
// contains filtered or unexported fields
}
func (SpansetOperation) String ¶
func (o SpansetOperation) String() string
type Static ¶
type Static struct {
Type StaticType
// contains filtered or unexported fields
}
func NewStaticBool ¶
func NewStaticBooleanArray ¶
func NewStaticDuration ¶
func NewStaticFloat ¶
func NewStaticFloatArray ¶
func NewStaticInt ¶
func NewStaticIntArray ¶
func NewStaticKind ¶
func NewStaticNil ¶
func NewStaticNil() Static
func NewStaticStatus ¶
func NewStaticString ¶
func NewStaticStringArray ¶
func StaticFromAnyValue ¶
func (Static) AsAnyValue ¶
func (Static) BooleanArray ¶
func (Static) Elements ¶
Elements iterate over the elements of a Static value. If the Static is not an array, it will loop over itself as the only element
func (Static) EncodeToString ¶
func (Static) FloatArray ¶
func (Static) Int64Array ¶
func (Static) MapKey ¶
func (s Static) MapKey() StaticMapKey
func (Static) StrictEquals ¶
func (Static) StringArray ¶
type StaticMapKey ¶
type StaticMapKey struct {
// contains filtered or unexported fields
}
type StaticType ¶
type StaticType int
const ( TypeNil StaticType = iota TypeSpanset // type used by spanset pipelines TypeAttribute // a special constant that indicates the type is determined at query time by the attribute TypeInt TypeFloat TypeString TypeBoolean TypeIntArray TypeFloatArray TypeStringArray TypeBooleanArray TypeDuration TypeStatus TypeKind )
func FloatizeAttribute ¶
func FloatizeAttribute(s Span, a Attribute) (float64, StaticType)
func (StaticType) String ¶
func (t StaticType) String() string
type StaticVals ¶
type StaticVals interface {
StaticVals1 | StaticVals2 | StaticVals3 | StaticVals4 | StaticVals5
}
type StaticVals1 ¶
type StaticVals1 [1]Static
type StaticVals2 ¶
type StaticVals2 [2]Static
type StaticVals3 ¶
type StaticVals3 [3]Static
type StaticVals4 ¶
type StaticVals4 [4]Static
type StaticVals5 ¶
type StaticVals5 [5]Static
type StepAggregator ¶
type StepAggregator struct {
// contains filtered or unexported fields
}
StepAggregator sorts spans into time slots using a step interval like 30s or 1m
func NewStepAggregator ¶
func NewStepAggregator(q *tempopb.QueryRangeRequest, innerAgg func() VectorAggregator) *StepAggregator
func (*StepAggregator) Exemplars ¶
func (s *StepAggregator) Exemplars() []Exemplar
func (*StepAggregator) Length ¶
func (s *StepAggregator) Length() int
func (*StepAggregator) Observe ¶
func (s *StepAggregator) Observe(span Span)
func (*StepAggregator) ObserveExemplar ¶
func (s *StepAggregator) ObserveExemplar(value float64, ts uint64, lbls Labels)
func (*StepAggregator) Samples ¶
func (s *StepAggregator) Samples() []float64
type TagNamesFetcher ¶
type TagNamesFetcher interface {
Fetch(context.Context, FetchTagsRequest, FetchTagsCallback) error
}
func NewTagNamesFetcherWrapper ¶
func NewTagNamesFetcherWrapper(f func(context.Context, FetchTagsRequest, FetchTagsCallback) error) TagNamesFetcher
type TagNamesFetcherWrapper ¶
type TagNamesFetcherWrapper struct {
// contains filtered or unexported fields
}
func (TagNamesFetcherWrapper) Fetch ¶
func (s TagNamesFetcherWrapper) Fetch(ctx context.Context, request FetchTagsRequest, callback FetchTagsCallback) error
type TagValuesFetcher ¶
type TagValuesFetcher interface {
Fetch(context.Context, FetchTagValuesRequest, FetchTagValuesCallback) error
}
func NewTagValuesFetcherWrapper ¶
func NewTagValuesFetcherWrapper(f func(context.Context, FetchTagValuesRequest, FetchTagValuesCallback) error) TagValuesFetcher
type TagValuesFetcherWrapper ¶
type TagValuesFetcherWrapper struct {
// contains filtered or unexported fields
}
func (TagValuesFetcherWrapper) Fetch ¶
func (s TagValuesFetcherWrapper) Fetch(ctx context.Context, request FetchTagValuesRequest, callback FetchTagValuesCallback) error
type TimeSeries ¶
type TopKBottomK ¶
type TopKBottomK struct {
// contains filtered or unexported fields
}
TopKBottomK handles second stage topK/bottomK operations
func (*TopKBottomK) String ¶
func (m *TopKBottomK) String() string
type UnaryOperation ¶
type UnaryOperation struct {
Op Operator
Expression FieldExpression
}
func (UnaryOperation) String ¶
func (o UnaryOperation) String() string
type UngroupedAggregator ¶
type UngroupedAggregator struct {
// contains filtered or unexported fields
}
UngroupedAggregator builds a single series with no labels. e.g. {} | rate()
func (*UngroupedAggregator) Length ¶
func (u *UngroupedAggregator) Length() int
func (*UngroupedAggregator) Observe ¶
func (u *UngroupedAggregator) Observe(span Span)
func (*UngroupedAggregator) ObserveExemplar ¶
func (u *UngroupedAggregator) ObserveExemplar(span Span, value float64, ts uint64)
func (*UngroupedAggregator) Series ¶
func (u *UngroupedAggregator) Series() SeriesSet
Series output. This is tweaked to match what prometheus does. For ungrouped metrics we fill in a placeholder metric name with the name of the aggregation. rate() => {__name__=rate}
type VectorAggregator ¶
VectorAggregator turns a vector of spans into a single numeric scalar
Source Files
¶
- ast.go
- ast_conditions.go
- ast_execute.go
- ast_metrics.go
- ast_metrics_math.go
- ast_rewriter.go
- ast_stringer.go
- ast_validate.go
- combine.go
- engine.go
- engine_metrics.go
- engine_metrics_average.go
- engine_metrics_compare.go
- engine_metrics_functions.go
- enum_aggregates.go
- enum_attributes.go
- enum_hints.go
- enum_operators.go
- enum_statics.go
- expr.y.go
- fake_data.go
- lenient_extract.go
- lenient_parser.go
- lexer.go
- options.go
- parse.go
- sampler.go
- series_heap.go
- storage.go
- util.go
- validate.go