jaegerclient

package
v1.23.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

ErrTraceNotFound is returned by GetTrace when Jaeger returns an empty data array for the given trace ID. Callers can check via errors.Is.

Functions

This section is empty.

Types

type Client

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

Client is a lightweight HTTP client for the Jaeger query API.

func NewClient

func NewClient(baseURL string, timeout time.Duration) *Client

NewClient creates a new Client targeting baseURL. If timeout is zero or negative the default of 30 s is used. Trailing slashes are stripped from baseURL so callers need not worry about double-slash paths.

func (*Client) FindTraces

func (c *Client) FindTraces(ctx context.Context, p FindTracesParams) ([]Trace, error)

FindTraces queries the Jaeger /api/traces endpoint and returns matching traces.

func (*Client) GetTrace

func (c *Client) GetTrace(ctx context.Context, traceID string) (*Trace, error)

GetTrace fetches a single trace by its ID from /api/traces/{id}. Returns ErrTraceNotFound (wrapped) when the trace is not found.

func (*Client) ListServices

func (c *Client) ListServices(ctx context.Context) ([]string, error)

ListServices returns the list of service names Jaeger has observed.

type FindTracesParams

type FindTracesParams struct {
	// Service is required — the Jaeger service name to search.
	Service string
	// Operation filters to a specific RPC/endpoint name (optional).
	Operation string
	// Tags is an optional key→value map for span tag filtering.
	Tags map[string]string
	// StartTime and EndTime define the time window (zero = omit).
	StartTime time.Time
	EndTime   time.Time
	// Limit caps the number of traces returned (0 = server default applies).
	Limit int
}

FindTracesParams holds query parameters for FindTraces.

type Process

type Process struct {
	ServiceName string    `json:"serviceName"`
	Tags        []SpanTag `json:"tags,omitempty"`
}

Process is one Jaeger process metadata (per-trace).

type Span

type Span struct {
	SpanID        string    `json:"spanID"`
	OperationName string    `json:"operationName"`
	Duration      int64     `json:"duration"`
	Tags          []SpanTag `json:"tags"`
}

Span represents a single Jaeger span within a trace.

type SpanTag

type SpanTag struct {
	Key   string `json:"key"`
	Type  string `json:"type"`
	Value any    `json:"value"`
}

SpanTag is a key-value pair attached to a span.

type Trace

type Trace struct {
	TraceID   string             `json:"traceID"`
	Spans     []Span             `json:"spans"`
	Processes map[string]Process `json:"processes,omitempty"`
}

Trace is a Jaeger distributed trace containing one or more spans.

Jump to

Keyboard shortcuts

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