trace2

package
v1.27.6 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

ErrNotFound is reported by Store.Get when a trace is not found.

Functions

This section is empty.

Types

type EventIterator

type EventIterator func(*tracepb2.TraceEvent) bool

An EventIterator is called once for each event in a trace, sequentially and in streaming fashion as events are read from the store.

If it returns false the stream is aborted and the function is not called again.

type ListEntryIterator

type ListEntryIterator func(*tracepb2.SpanSummary) bool

A ListEntryIterator is called once for each trace matching the query string, sequentially and in streaming fashion as traces are read from the store.

If it returns false the listing operation is stopped and the function is not called again.

type Meta

type Meta struct {
	AppID string
}

type Query

type Query struct {
	AppID        string
	Service      string
	Endpoint     string
	Topic        string
	Subscription string
	TraceID      string
	MessageID    string
	Tags         []Tag

	// StartTime and EndTime specify the time range to query.
	// If zero values they are not bounded.
	StartTime, EndTime time.Time

	IsError *bool // nil means both successes and failures are returned

	// Minimum and maximum duration (in nanoseconds) to filter requests for.
	// If MaxDurMicros is 0 it defaults to no limit.
	MinDurNanos, MaxDurNanos uint64

	Limit int // if 0 defaults to 100.
}

type RecordData

type RecordData struct {
	Meta         *Meta
	TraceVersion trace2.Version
	Buf          *bufio.Reader
	Anchor       trace2.TimeAnchor
}

type Recorder

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

func NewRecorder

func NewRecorder(s Store) *Recorder

func (*Recorder) RecordTrace

func (h *Recorder) RecordTrace(data RecordData) error

type Store

type Store interface {
	// WriteEvents persists requests in the store.
	WriteEvents(ctx context.Context, meta *Meta, events []*tracepb2.TraceEvent) error

	// List lists traces that match the query.
	// It calls fn for each trace read; see ListEntryIterator.
	List(ctx context.Context, q *Query, iter ListEntryIterator) error

	// Get streams events matching the given trace id.
	// fn may be called with events out of order.
	// If the trace is not found it reports an error matching ErrNotFound.
	Get(ctx context.Context, appID, traceID string, iter EventIterator) error

	// Listen listens for new spans.
	Listen(ch chan<- *tracepb2.SpanSummary)
}

Store is the interface for storing and retrieving traces.

type Tag

type Tag struct {
	Key   string
	Value string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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