traceql

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Code generated by goyacc -l -o pkg/traceql/expr.y.go pkg/traceql/expr.y. DO NOT EDIT.

Index

Constants

View Source
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"
)
View Source
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
)
View Source
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.

View Source
const ADD = 57444
View Source
const ANCE = 57433
View Source
const AND = 57422
View Source
const AVG = 57401
View Source
const AVG_OVER_TIME = 57413
View Source
const BOTTOMK = 57419
View Source
const BY = 57405
View Source
const CHILDCOUNT = 57370
View Source
const CLOSE_BRACE = 57353
View Source
const CLOSE_PARENS = 57355
View Source
const COALESCE = 57406
View Source
const COMMA = 57356
View Source
const COMPARE = 57417
View Source
const COUNT = 57400
View Source
const COUNT_OVER_TIME = 57410
View Source
const DESC = 57432
View Source
const DIV = 57448
View Source
const DOT = 57351
View Source
const DURATION = 57350
View Source
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.

View Source
const (
	DefaultSpansPerSpanSet int = 3
)
View Source
const END_ATTRIBUTE = 57408
View Source
const EQ = 57424
View Source
const EVENT_COLON = 57394
View Source
const EVENT_DOT = 57395
View Source
const FALSE = 57359
View Source
const FLOAT = 57349
View Source
const GT = 57428
View Source
const GTE = 57429
View Source
const HISTOGRAM_OVER_TIME = 57416
View Source
const ID = 57383
View Source
const IDENTIFIER = 57346
View Source
const IDURATION = 57369
View Source
const INSTRUMENTATION_COLON = 57398
View Source
const INSTRUMENTATION_DOT = 57399
View Source
const INTEGER = 57348
View Source
const KIND = 57375
View Source
const KIND_CLIENT = 57366
View Source
const KIND_CONSUMER = 57368
View Source
const KIND_INTERNAL = 57364
View Source
const KIND_PRODUCER = 57367
View Source
const KIND_SERVER = 57365
View Source
const KIND_UNSPECIFIED = 57363
View Source
const LINK_COLON = 57396
View Source
const LINK_DOT = 57397
View Source
const LT = 57426
View Source
const LTE = 57427
View Source
const MAX = 57402
View Source
const MAX_OVER_TIME = 57412
View Source
const MIN = 57403
View Source
const MIN_OVER_TIME = 57411
View Source
const MOD = 57449
View Source
const MUL = 57447
View Source
const NAME = 57371
View Source
const NEQ = 57425
View Source
const NESTEDSETLEFT = 57380
View Source
const NESTEDSETPARENT = 57382
View Source
const NESTEDSETRIGHT = 57381
View Source
const NIL = 57357
View Source
const NOT = 57446
View Source
const NOT_ANCE = 57438
View Source
const NOT_CHILD = 57435
View Source
const NOT_DESC = 57437
View Source
const NOT_PARENT = 57436
View Source
const NRE = 57430
View Source
const OPEN_BRACE = 57352
View Source
const OPEN_PARENS = 57354
View Source
const OR = 57423
View Source
const PARENT = 57374
View Source
const PARENT_DOT = 57389
View Source
const PARENT_ID = 57386
View Source
const PIPE = 57421
View Source
const POW = 57450
View Source
const QUANTILE_OVER_TIME = 57415
View Source
const RATE = 57409
View Source
const RE = 57431
View Source
const RESOURCE_DOT = 57390
View Source
const ROOTNAME = 57376
View Source
const ROOTSERVICE = 57378
View Source
const ROOTSERVICENAME = 57377
View Source
const SELECT = 57407
View Source
const SIBL = 57434
View Source
const SPAN_COLON = 57393
View Source
const SPAN_DOT = 57391
View Source
const SPAN_ID = 57385
View Source
const STATUS = 57372
View Source
const STATUS_ERROR = 57360
View Source
const STATUS_MESSAGE = 57373
View Source
const STATUS_OK = 57361
View Source
const STATUS_UNSET = 57362
View Source
const STRING = 57347
View Source
const SUB = 57445
View Source
const SUM = 57404
View Source
const SUM_OVER_TIME = 57414
View Source
const TIMESINCESTART = 57387
View Source
const TOPK = 57418
View Source
const TRACEDURATION = 57379
View Source
const TRACE_COLON = 57392
View Source
const TRACE_ID = 57384
View Source
const TRUE = 57358
View Source
const TimestampNever = uint32(math.MaxUint32)
View Source
const UNION_ANCE = 57442
View Source
const UNION_CHILD = 57439
View Source
const UNION_DESC = 57441
View Source
const UNION_PARENT = 57440
View Source
const UNION_SIBL = 57443
View Source
const VERSION = 57388
View Source
const WITH = 57420

Variables

View Source
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)
)
View Source
var (
	StaticNil   = NewStaticNil()
	StaticTrue  = NewStaticBool(true)
	StaticFalse = NewStaticBool(false)
)
View Source
var ErrMathNotSupported = errors.New("math expressions not supported")
View Source
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

Compile parses and compiles a TraceQL query. Options specific to metrics queries are ignored. It does not support math expressions.

func ContainsNonAttributeRune

func ContainsNonAttributeRune(s string) bool

func DefaultQueryRangeStep

func DefaultQueryRangeStep(start, end uint64) uint64

func ExtractConditionGroups

func ExtractConditionGroups(query string, maxGroups int) ([][]Condition, error)

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

func IsEmptyQuery(query string) bool

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

func IsValidTransformationName(name string) bool

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

func Log2Bucketize(v uint64) float64

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 MakeCollectTagValueFunc(collect func(tempopb.TagValue) bool) func(v Static) bool

func NeedsFullTrace

func NeedsFullTrace(e ...Element) bool

func NormalizeQuery

func NormalizeQuery(query string) string

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.

func Validate

func Validate(expr *RootExpr) error

Types

type ASTRewriter

type ASTRewriter interface {
	RewriteRoot(*RootExpr) *RootExpr
}

ASTRewriter modifies a TraceQL AST without changing its meaning.

type Aggregate

type Aggregate struct {
	// contains filtered or unexported fields
}

func (Aggregate) String

func (a Aggregate) String() string

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 MustParseIdentifier(s string) Attribute

func NewAttribute

func NewAttribute(att string) Attribute

NewAttribute creates a new attribute with the given identifier string.

func NewIntrinsic

func NewIntrinsic(n Intrinsic) Attribute

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

func ParseIdentifier(s string) (Attribute, error)

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.

func (Attribute) String

func (a Attribute) String() string

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 CommonIterator[T any] interface {
	Next(context.Context) (T, error)
	Close()
}

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 ExemplarMetaConditions(cb func() bool) []Condition

func ExemplarMetaConditionsWithout

func ExemplarMetaConditionsWithout(cb func() bool, remove []Condition, allConditions bool) []Condition

func SearchMetaConditions

func SearchMetaConditions() []Condition

func SearchMetaConditionsWithout

func SearchMetaConditionsWithout(remove []Condition, allConditions bool) []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 Element

type Element interface {
	fmt.Stringer
	// contains filtered or unexported methods
}

type Engine

type Engine struct{}

func NewEngine

func NewEngine() *Engine

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 Exemplar

type Exemplar struct {
	Labels      Labels
	Value       float64
	TimestampMs uint64
}

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

type FetchTagValuesCallback func(static Static) bool

FetchTagValuesCallback is called to collect unique tag values. Returns true if it has exceeded the maximum number of results.

type FetchTagValuesRequest

type FetchTagValuesRequest struct {
	ConditionGroups [][]Condition
	TagName         Attribute
}

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 Hint

type Hint struct {
	Name  string
	Value Static
}

type Hints

type Hints struct {
	Hints []*Hint
}

func (*Hints) Get

func (h *Hints) Get(k string, t StaticType, allowUnsafe bool) (v Static, ok bool)

func (*Hints) GetBool

func (h *Hints) GetBool(k string, allowUnsafe bool) (v, ok bool)

func (*Hints) GetDuration

func (h *Hints) GetDuration(k string, allowUnsafe bool) (v time.Duration, ok bool)

func (*Hints) GetFloat

func (h *Hints) GetFloat(k string, allowUnsafe bool) (v float64, ok bool)

func (*Hints) GetInt

func (h *Hints) GetInt(k string, allowUnsafe bool) (v int, ok bool)

func (*Hints) GetStringSlice

func (h *Hints) GetStringSlice(k string, allowUnsafe bool) (v []string, ok bool)

func (*Hints) String

func (h *Hints) String() string

type Histogram

type Histogram struct {
	Buckets []HistogramBucket
}

func (*Histogram) Record

func (h *Histogram) Record(bucket float64, count int)

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 HistogramBucket struct {
	Max   float64
	Count int
}

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

func (Intrinsic) String

func (i Intrinsic) String() string

type Kind

type Kind int
const (
	KindUnspecified Kind = iota
	KindInternal
	KindClient
	KindServer
	KindProducer
	KindConsumer
)

func (Kind) String

func (k Kind) String() string

type Label

type Label struct {
	Name  string
	Value Static
}

type Labels

type Labels []Label

func LabelsFromArgs

func LabelsFromArgs(args ...any) Labels

func LabelsFromProto

func LabelsFromProto(ls []commonv1proto.KeyValue) Labels

func (Labels) Add

func (ls Labels) Add(label Label) Labels

Add returns a copy of the labels with the given label added to the end.

func (Labels) GetValue

func (ls Labels) GetValue(name string) Static

func (Labels) Has

func (ls Labels) Has(name string) bool

func (Labels) MapKey

func (ls Labels) MapKey() SeriesMapKey

func (Labels) String

func (ls Labels) String() string

String returns the prometheus-formatted version of the labels. Which is downcasting the typed TraceQL values to strings, with some special casing.

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 MetricsEvaluator interface {
	Do(ctx context.Context, f SpansetFetcher, fetcherStart, fetcherEnd uint64, maxSeries int) error
	Length() int
	Metrics() (uint64, uint64, uint64)
	Results() SeriesSet
}

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 Operands

type Operands []Static

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
)

func (Operator) String

func (op Operator) String() string

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
}

func (Pipeline) String

func (p Pipeline) String() string

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

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

func ApplyASTRewrites(r *RootExpr, skip []string) *RootExpr

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

func ParseLenient(s string) (*RootExpr, error)

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

func ParseNoOptimizations(s string) (*RootExpr, error)

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

func (r *RootExpr) IsNoop() bool

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

func (r *RootExpr) SinglePipeline() (Pipeline, bool)

SinglePipeline returns the pipeline when there is exactly one sub-query. Returns false for math expressions (multiple pipelines).

func (RootExpr) String

func (r RootExpr) String() string

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

type SecondPassFn func(*Spanset) ([]*Spanset, error)

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 ServiceStats struct {
	SpanCount  uint32
	ErrorCount uint32
}

type SimpleAggregationOp

type SimpleAggregationOp int

type SimpleAggregator

type SimpleAggregator struct {
	// contains filtered or unexported fields
}

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

func (s *Spanset) AddAttribute(key string, value Static)

func (*Spanset) Release

func (s *Spanset) Release()

Release the spanset and all its span. This is just a wrapper of ReleaseFn that performs nil checks.

type SpansetAttribute

type SpansetAttribute struct {
	Name string
	Val  Static
}

type SpansetExpression

type SpansetExpression interface {
	PipelineElement
	// contains filtered or unexported methods
}

********************** Spansets **********************

type SpansetFetcher

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 (SpansetFetcherWrapper) FetchSpans

type SpansetFilter

type SpansetFilter struct {
	Expression FieldExpression
	// contains filtered or unexported fields
}

func (SpansetFilter) String

func (f SpansetFilter) String() string

type SpansetFilterFunc

type SpansetFilterFunc func(input []*Spanset) (result []*Spanset, err error)

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 NewStaticBool(b bool) Static

func NewStaticBooleanArray

func NewStaticBooleanArray(b []bool) Static

func NewStaticDuration

func NewStaticDuration(d time.Duration) Static

func NewStaticFloat

func NewStaticFloat(f float64) Static

func NewStaticFloatArray

func NewStaticFloatArray(f []float64) Static

func NewStaticInt

func NewStaticInt(i int) Static

func NewStaticIntArray

func NewStaticIntArray(i []int) Static

func NewStaticKind

func NewStaticKind(k Kind) Static

func NewStaticNil

func NewStaticNil() Static

func NewStaticStatus

func NewStaticStatus(s Status) Static

func NewStaticString

func NewStaticString(s string) Static

func NewStaticStringArray

func NewStaticStringArray(s []string) Static

func StaticFromAnyValue

func StaticFromAnyValue(a *common_v1.AnyValue) Static

func (Static) AsAnyValue

func (s Static) AsAnyValue() *common_v1.AnyValue

func (Static) Bool

func (s Static) Bool() (bool, bool)

func (Static) BooleanArray

func (s Static) BooleanArray() ([]bool, bool)

func (Static) Duration

func (s Static) Duration() (time.Duration, bool)

func (Static) Elements

func (s Static) Elements() iter.Seq2[int, Static]

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 (s Static) EncodeToString(quotes bool) string

func (Static) Equals

func (s Static) Equals(o *Static) bool

func (Static) Float

func (s Static) Float() float64

func (Static) FloatArray

func (s Static) FloatArray() ([]float64, bool)

func (Static) Int

func (s Static) Int() (int, bool)

func (Static) Int64Array

func (s Static) Int64Array() ([]int64, bool)

func (Static) IntArray

func (s Static) IntArray() ([]int, bool)

func (Static) IsNil

func (s Static) IsNil() bool

func (Static) Kind

func (s Static) Kind() (Kind, bool)

func (Static) MapKey

func (s Static) MapKey() StaticMapKey

func (Static) NotEquals

func (s Static) NotEquals(o *Static) bool

func (Static) Status

func (s Static) Status() (Status, bool)

func (Static) StrictEquals

func (s Static) StrictEquals(o *Static) bool

func (Static) String

func (s Static) String() string

func (Static) StringArray

func (s Static) StringArray() ([]string, bool)

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 Status

type Status int

Status represents valid static values of typeStatus

const (
	StatusError Status = iota
	StatusOk
	StatusUnset
)

func (Status) String

func (s Status) String() string

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
}

type TagNamesFetcherWrapper

type TagNamesFetcherWrapper struct {
	// contains filtered or unexported fields
}

func (TagNamesFetcherWrapper) Fetch

type TagValuesFetcherWrapper

type TagValuesFetcherWrapper struct {
	// contains filtered or unexported fields
}

func (TagValuesFetcherWrapper) Fetch

type TimeSeries

type TimeSeries struct {
	Labels    Labels
	Values    []float64
	Exemplars []Exemplar
}

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

type VectorAggregator interface {
	Observe(s Span)
	Sample() float64
}

VectorAggregator turns a vector of spans into a single numeric scalar

Jump to

Keyboard shortcuts

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