Documentation
¶
Overview ¶
Package trace provides a tracing system for Reflow events. Following Dapper [1], trace events are named by a span. Spans are coordinates in a tree of events, and each span is associated with a logical timeline (e.g., an exec, a cache lookup, a run, etc.). Traces thus form a tree of timelines, where the operation represented by a single timeline is dependent on all of its child timelines.
A span's ID is the 3-tuple
parent ID, ID, span kind
The parent ID is the ID of the span's parent. (The ID 0 is reserved for the root span.) The ID is a unique ID to the span itself, and the span's kind tells what kind of timeline the span represents (e.g., a cache lookup, or a command execution).
Additionally, each event is associated with a timestamp and an event type.
Tracing metadata is propagated through Go's context mechanism: each operation that creates a new span is given a context that represents that span. Package functions are provided to emit trace events to the current span, as defined a context.
Index ¶
- func Emit(ctx context.Context, event Event) error
- func Note(ctx context.Context, key string, value interface{})
- func On(ctx context.Context) bool
- func Start(ctx context.Context, kind Kind, id digest.Digest) (outctx context.Context, done func())
- func WithTracer(ctx context.Context, tracer Tracer) context.Context
- type Event
- type EventKind
- type Kind
- type Span
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Note ¶
Note emits the provided key and value as a trace event associated with the span of the provided context.
Types ¶
type Event ¶
type Event struct { // Time is the timestamp of the event, generated at the source of // that event. Time time.Time // Span is the span to which this event belongs. Span Span // Kind is the type of event. Kind EventKind // Key stores the key for NoteEvents. Key string // Value stores the value for NoteEvents. Value interface{} }
Event stores a single trace event. Each event must have at least a timestamp, span, and an event kind. Other arguments depend on the event kind.