query

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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
	// 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 GetTrace

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

GetTrace returns all spans of a trace in []*Row format. It search in the index stream for the approximate timestamp. If found: - search for span in time range [aTimestamp-traceMaxDurationWindow, aTimestamp+traceMaxDurationWindow]. If not found: - search span by step via findSpansByTraceID.

todo in-memory cache of hot traces.

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 search 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 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