tracequery

package
v0.1.82 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTraceNotFound = errors.New("trace not found")

Functions

This section is empty.

Types

type AttributeCount

type AttributeCount struct {
	Value string `json:"value"`
	Count int    `json:"count"`
}

AttributeCount is how many traces' root spans carry key=value.

type Detail

type Detail struct {
	Summary        Summary  `json:"summary"`
	Spans          []Span   `json:"spans"`
	MissingParents []string `json:"missingParents"`
}

func Trace

func Trace(spans []Span, id string) (Detail, error)

type DocumentFormat

type DocumentFormat string

func (DocumentFormat) JSONSchema

func (DocumentFormat) JSONSchema() map[string]any

type Mode

type Mode string

Mode includes or excludes a filter value.

const (
	Include Mode = "include"
	Exclude Mode = "exclude"
)

type Modes

type Modes map[string]Mode

Modes are a filter's values, each included or excluded: a trace passes when it has one of the included values (or none is included) and none of the excluded ones.

func (Modes) JSONSchema

func (Modes) JSONSchema() map[string]any

type OperationStats

type OperationStats struct {
	Operation string `json:"operation"`
	Count     int    `json:"count"`
	// SingleSpan is set when every one of them is a single span.
	SingleSpan bool    `json:"singleSpan,omitempty"`
	P50Ms      float64 `json:"p50Ms"`
	P95Ms      float64 `json:"p95Ms"`
}

OperationStats are the traces of one root operation.

type Request

type Request struct {
	Source      string         `json:"source" clicky:"title=Source,required"`
	Run         string         `json:"run,omitempty" clicky:"title=Run,desc=Optional recorded run ID"`
	Index       string         `json:"index,omitempty" clicky:"title=Index,desc=OpenSearch index pattern (default otel-traces-*)"`
	Format      DocumentFormat `json:"format,omitempty" clicky:"title=Document format"`
	Services    Modes          `json:"services,omitempty" clicky:"title=Services,desc=Services a trace's spans run in: each included or excluded"`
	Operations  Modes          `json:"operations,omitempty" clicky:"title=Root operations,desc=A trace's root operation: each included or excluded"`
	Statuses    Modes          `json:"statuses,omitempty" clicky:"title=Statuses,desc=error (a span failed) or ok: each included or excluded"`
	Attributes  Modes          `` /* 156-byte string literal not displayed */
	MinSpans    int            `json:"minSpans,omitempty" clicky:"title=Minimum spans,desc=Traces of at least this many spans"`
	TraceID     string         `json:"traceId,omitempty" clicky:"title=Trace ID"`
	Lookback    string         `json:"lookback,omitempty" clicky:"title=Lookback,desc=Duration such as 15m or 24h; used when From is empty"`
	From        string         `json:"from,omitempty" clicky:"title=From,desc=Inclusive RFC3339 timestamp"`
	Until       string         `json:"until,omitempty" clicky:"title=Until,desc=Exclusive RFC3339 timestamp"`
	MinDuration string         `json:"minDuration,omitempty" clicky:"title=Minimum trace duration,desc=Duration such as 100ms or 2s"`
	MaxDuration string         `json:"maxDuration,omitempty" clicky:"title=Maximum trace duration,desc=Duration such as 100ms or 2s"`
	Limit       int            `json:"limit,omitempty" clicky:"title=Trace limit,desc=Maximum traces (1 to 1000); spans of a trace stay together"`
	Offset      int            `json:"offset,omitempty" clicky:"title=Trace offset,desc=Matching traces to skip, newest first, before the limit applies"`
}

type SearchResult

type SearchResult struct {
	Traces []Summary `json:"traces"`
	Total  int       `json:"total"`
	// Services are those of every trace in the window.
	Services []string `json:"services"`
	// RootOperations count the traces in the window that pass every filter
	// but the operation and span-count ones, by root operation.
	RootOperations []OperationStats `json:"rootOperations"`
	// Attributes suggest values of those traces' root spans, most frequent first.
	Attributes []AttributeCount `json:"attributes"`
}
func Search(spans []Span, r Request) (SearchResult, error)

Search filters whole traces with a span in the window: by their duration, services, status, any span's attributes, root operation and span count.

type Service

type Service struct {
	Connections *store.Store
	Read        func(context.Context, Request, []string) ([]Span, error)
}

func (Service) ReadSpans

func (s Service) ReadSpans(ctx context.Context, r Request, ids []string) ([]Span, error)

ReadSpans reads the spans selected by a host without assembling a search.

func (Service) Search

func (s Service) Search(ctx context.Context, r Request) (SearchResult, error)

func (Service) Sources

func (s Service) Sources() ([]Source, error)

func (Service) Trace

func (s Service) Trace(ctx context.Context, r Request, id string) (Detail, error)

type Source

type Source struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

type Span

type Span = span.Span

func FromRow

func FromRow(row query.Row) (Span, error)

FromRow projects a provider row through the shared canonical span boundary.

func ReadOpenSearch

func ReadOpenSearch(queryContext dbcontext.Context, r Request, c *models.Connection, ids []string) ([]Span, error)

type Summary

type Summary struct {
	TraceID    string    `json:"traceId"`
	Operation  string    `json:"operation"`
	Service    string    `json:"service"`
	StartedAt  time.Time `json:"startedAt"`
	DurationMs float64   `json:"durationMs"`
	SpanCount  int       `json:"spanCount"`
	Errors     int       `json:"errors"`
	Services   []string  `json:"services"`
}

Jump to

Keyboard shortcuts

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