client

package
v0.0.0-...-3736fb9 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package client provides a Jaegar client for grabbing traces from the Jaegar service. It is a wrapper around the undocumented Jaegar gRPC client.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound indicates that no trace with an ID was found.
	ErrNotFound = errors.New("trace with that ID was not found")
)

Functions

This section is empty.

Types

type Jaeger

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

Jaeger provides a client for interacting with Jaeger to retrieve traces.

func New

func New(addr string) (*Jaeger, error)

New creates a new Jaeger client that connects to addr.

func (*Jaeger) Addr

func (j *Jaeger) Addr() string

Addr returns the address of the Jaeger server we are connected to.

func (*Jaeger) Search

func (j *Jaeger) Search(ctx context.Context, params SearchParams) (chan Trace, error)

Search searches Jaeger for traces that match the SearchParams. Each result is the set of spans that make up a trace.

func (*Jaeger) Trace

func (j *Jaeger) Trace(ctx context.Context, id string) (Trace, error)

Trace allows retreival of a specific trace from Jaegar by its ID.

type SearchParams

type SearchParams struct {
	// Service is the name of the service you are querying. Required.
	Service string
	// Operation is the name of the operation you want to filter by.
	Operation string
	// Tag values you want to filter by.
	Tags []string
	// Start is the lower bounds (inclusive) that a trace can start at.
	Start time.Time
	// End is the uppper bounds (exclusive) a trace can end at.
	End time.Time
	// DurationMin is the minimum duration a trace (inclusive) must have.
	DurationMin time.Duration
	// DurationMax is the maximum duration a trace (exclusive) can have.
	DurationMax time.Duration
	// SearchDepth is a quirky setting. It is kinda tells the data store how hard to search.
	// On data stores like Cassandra, settting this to a higher number will cause it
	// to search deeper in its trees for the data. So a setting of 20 might get 8 results, but 200 will get
	// 15. This looks to have only a limit like effect on other storage systems. This defaults to 200.
	SearchDepth int32
}

SearchParams are parameters used to filter a search for trace data.

type Span

type Span struct {
	*mpb.Span
}

Span is a convienence wrapper around *mpb.Span.

func (Span) Proto

func (s Span) Proto() *mpb.Span

Proto returns the encapsulated proto. Remember that these are generated with gogo proto and not Google/Buf.build proto engine.

func (Span) SpanID

func (s Span) SpanID() string

SpanID returns the converted human readable Span ID.

func (Span) TraceID

func (s Span) TraceID() string

TraceID returns the converted human readable Trace ID.

type Trace

type Trace struct {
	// ID is the identity of the trace.
	ID string
	// Spans are the spans that make up the trace.
	Spans []Span

	// Err indicates if there was a error in the trace stream if the
	// Trace is being returned in a channel. If not, this will always be nil.
	Err error
}

Trace represents a OTEL trace that was stored in Jaegar.

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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