query

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetServiceGraphTimeRange added in v0.4.0

func GetServiceGraphTimeRange(ctx context.Context, tenantID logstorage.TenantID, startTime, endTime time.Time, limit uint64) ([][]logstorage.Field, error)

GetServiceGraphTimeRange is an internal function used by service graph background task. It calculates the service graph relation within the time range in (parent, child, callCount) format for specific tenant.

func GetServiceNameList

func GetServiceNameList(ctx context.Context, cp *CommonParams) ([]string, error)

GetServiceNameList returns all unique service names within *traceServiceAndSpanNameLookbehind window. todo: cache of recent result.

func GetSpanNameList

func GetSpanNameList(ctx context.Context, cp *CommonParams, serviceName string) ([]string, error)

GetSpanNameList returns all unique span names for a service within *traceServiceAndSpanNameLookbehind window. todo: cache of recent result.

Types

type CommonParams

type CommonParams struct {
	TenantIDs []logstorage.TenantID
	Query     *logstorage.Query

	// Whether to disable compression of the response sent to the vtselect.
	DisableCompression bool

	// Whether to allow partial response when some of vtstorage nodes are unavailable.
	AllowPartialResponse bool

	// Optional list of log fields or log field prefixes ending with *, which must be hidden during query execution.
	HiddenFieldsFilters []string
	// contains filtered or unexported fields
}

CommonParams common query params that shared by all requests.

func GetCommonParams

func GetCommonParams(r *http.Request) (*CommonParams, error)

GetCommonParams get common params from request for all traces query APIs.

func (*CommonParams) NewQueryContext added in v0.3.0

func (cp *CommonParams) NewQueryContext(ctx context.Context) *logstorage.QueryContext

func (*CommonParams) UpdatePerQueryStatsMetrics added in v0.3.0

func (cp *CommonParams) UpdatePerQueryStatsMetrics()

type Row

type Row struct {
	Timestamp int64
	Fields    []logstorage.Field
}

Row represent the query result of a trace span.

func GetServiceGraphList added in v0.4.0

func GetServiceGraphList(ctx context.Context, cp *CommonParams, param *ServiceGraphQueryParameters) ([]*Row, error)

GetServiceGraphList returns service dependencies graph edges (parent, child, callCount) in []*Row format.

TODO: currently this function can only handle request from Jaeger dependencies API. Since Tempo provides similar service graph feature, it would be great to add support for Tempo service graph API as well.

func GetTrace

func GetTrace(ctx context.Context, cp *CommonParams, traceID string) ([]*Row, error)

GetTrace returns all spans of a trace in []*Row format. It searches in the index stream for start_time and end_time. If found: - search for span in time range [start_time, end_time].

func GetTraceList

func GetTraceList(ctx context.Context, cp *CommonParams, param *TraceQueryParam) ([]string, []*Row, error)

GetTraceList returns multiple traceIDs and spans of them in []*Row format. It searches for traceIDs first, and then search for the spans of these traceIDs. To not miss any spans on the edge, it extends both the start time and end time by *traceMaxDurationWindow.

e.g.: 1. input time range: [00:00, 09:00] 2. found 20 trace id, and adjust time range to: [08:00, 09:00] 3. find spans on time range: [08:00-traceMaxDurationWindow, 09:00+traceMaxDurationWindow]

type ServiceGraphQueryParameters added in v0.4.0

type ServiceGraphQueryParameters struct {
	EndTs    time.Time
	Lookback time.Duration
}

type TraceQueryParam

type TraceQueryParam struct {
	ServiceName  string
	SpanName     string
	Attributes   map[string]string
	StartTimeMin time.Time
	StartTimeMax time.Time
	DurationMin  time.Duration
	DurationMax  time.Duration
	Limit        int
}

TraceQueryParam is the parameters for querying a batch of traces.

Jump to

Keyboard shortcuts

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