Documentation
¶
Index ¶
- Constants
- func FormatDuration(d time.Duration) string
- func ShouldSkipFunction(obj, field string) bool
- func WalkTree(tree []*TraceTree, f func(*TraceTree, int) WalkDecision)
- type Activity
- type DB
- func (db *DB) Aggregation(sdkmetric.InstrumentKind) sdkmetric.Aggregation
- func (db *DB) AllSpans() iter.Seq[*Span]
- func (db *DB) Call(dig string) *callpbv1.Call
- func (*DB) Close() error
- func (db *DB) CollectErrors(rows *RowsView) []*TraceTree
- func (db *DB) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error
- func (db *DB) FindResource(filter attribute.KeyValue) *resource.Resource
- func (db *DB) ForceFlush(ctx context.Context) error
- func (db *DB) HighLevelSpan(call *callpbv1.Call) *Span
- func (db *DB) ImportSnapshots(snapshots []SpanSnapshot)
- func (db *DB) LogExporter() sdklog.Exporter
- func (db *DB) MetricExporter() sdkmetric.Exporter
- func (db *DB) MostInterestingSpan(dig string) *Span
- func (db *DB) MustCall(dig string) *callpbv1.Call
- func (db *DB) RemainingSnapshots() []SpanSnapshot
- func (db *DB) RowsView(opts FrontendOpts) *RowsView
- func (db *DB) SetPrimarySpan(span SpanID)
- func (db *DB) Shutdown(ctx context.Context) error
- func (db *DB) Simplify(call *callpbv1.Call, force bool) (smallest *callpbv1.Call)
- func (db *DB) SpanSnapshots(id SpanID) []SpanSnapshot
- func (db *DB) Temporality(sdkmetric.InstrumentKind) metricdata.Temporality
- func (db *DB) UpdatedSnapshots(filter map[SpanID]bool) []SpanSnapshot
- func (db *DB) WalkSpans(opts FrontendOpts, spans iter.Seq[*Span], f func(*TraceTree))
- func (db *DB) WriteDot(outputFilePath string, focusField string, showInternal bool)
- type DBLogExporter
- type DBMetricExporter
- type FrontendOpts
- type Interval
- type OrderedSet
- type Rows
- type RowsView
- type Span
- func (span *Span) Base() *callpbv1.Call
- func (span *Span) Before(other *Span) bool
- func (span *Span) CachedReason() (bool, []string)
- func (span *Span) Call() *callpbv1.Call
- func (span *Span) CanceledReason() (bool, []string)
- func (span *Span) CausalSpans(f func(*Span) bool)
- func (span *Span) Classes() []string
- func (span *Span) EffectSpans(f func(*Span) bool)
- func (span *Span) EndTimeOrFallback(fallbackEnd time.Time) time.Time
- func (span *Span) EndTimeOrNow() time.Time
- func (span *Span) Errors() SpanSet
- func (span *Span) FailedReason() (bool, []string)
- func (span *Span) HasParent(parent *Span) bool
- func (span *Span) Hidden(opts FrontendOpts) bool
- func (span *Span) IsCached() bool
- func (span *Span) IsCanceled() bool
- func (span *Span) IsFailed() bool
- func (span *Span) IsFailedOrCausedFailure() bool
- func (span *Span) IsInternal() bool
- func (span *Span) IsOK() bool
- func (span *Span) IsPending() bool
- func (span *Span) IsRunning() bool
- func (span *Span) IsRunningOrEffectsRunning() bool
- func (span *Span) IsUnset() bool
- func (span *Span) Matches(match func(*Span) bool) bool
- func (span *Span) Parents(f func(*Span) bool)
- func (span *Span) PendingReason() (bool, []string)
- func (span *Span) PropagateStatusToParentsAndLinks()
- func (span *Span) Snapshot() SpanSnapshot
- func (span *Span) VisibleParent(opts FrontendOpts) *Span
- type SpanContext
- type SpanID
- type SpanSet
- type SpanSnapshot
- type Task
- type TraceID
- type TraceRow
- type TraceTree
- type WalkDecision
Constants ¶
const ( HideCompletedVerbosity = 0 ShowCompletedVerbosity = 1 ExpandCompletedVerbosity = 2 ShowInternalVerbosity = 3 ShowEncapsulatedVerbosity = 3 ShowSpammyVerbosity = 4 ShowDigestsVerbosity = 4 ShowMetricsVerbosity = 3 )
Variables ¶
This section is empty.
Functions ¶
func FormatDuration ¶
func ShouldSkipFunction ¶ added in v0.15.4
Types ¶
type Activity ¶ added in v0.15.0
type Activity struct { CompletedIntervals []Interval EarliestRunning time.Time // Keep track of the full set of running spans so we can update // EarliestRunning as they complete. // // This needs to be synced to the frontend so it doesn't lose track of the // running status in updateEarliest. We exclude from JSON marshalling since // the map key is incompatible. Syncing to the frontend uses encoding/gob, // which accepts the map key type. AllRunning map[SpanID]time.Time `json:"-"` }
func (*Activity) EndTimeOrFallback ¶ added in v0.15.0
type DB ¶
type DB struct { PrimarySpan SpanID PrimaryLogs map[SpanID][]sdklog.Record Epoch, End time.Time Spans *OrderedSet[SpanID, *Span] RootSpan *Span Resources map[attribute.Distinct]*resource.Resource CallPayloads map[string]string Calls map[string]*callpbv1.Call Outputs map[string]map[string]struct{} OutputOf map[string]map[string]struct{} Intervals map[string]map[time.Time]*Span CauseSpans map[string]SpanSet EffectSpans map[string]SpanSet CompletedEffects map[string]bool FailedEffects map[string]bool // Map of call digest -> metric name -> data points // NOTE: this is hard coded for Gauge int64 metricdata essentially right now, // needs generalization as more metric types get added MetricsByCall map[string]map[string][]metricdata.DataPoint[int64] // contains filtered or unexported fields }
func (*DB) Aggregation ¶ added in v0.13.6
func (db *DB) Aggregation(sdkmetric.InstrumentKind) sdkmetric.Aggregation
func (*DB) CollectErrors ¶ added in v0.15.0
func (*DB) ExportSpans ¶
func (*DB) FindResource ¶ added in v0.15.0
func (*DB) ImportSnapshots ¶ added in v0.15.0
func (db *DB) ImportSnapshots(snapshots []SpanSnapshot)
func (*DB) LogExporter ¶
func (*DB) MetricExporter ¶ added in v0.13.6
func (*DB) MostInterestingSpan ¶
func (*DB) RemainingSnapshots ¶ added in v0.15.0
func (db *DB) RemainingSnapshots() []SpanSnapshot
func (*DB) RowsView ¶
func (db *DB) RowsView(opts FrontendOpts) *RowsView
func (*DB) SetPrimarySpan ¶
SetPrimarySpan allows the primary span to be explicitly set to a particular span. normally we assume the root span is the primary span, but in a nested scenario we never actually see the root span, so the CLI explicitly sets it to the span it created.
func (*DB) SpanSnapshots ¶ added in v0.15.0
func (db *DB) SpanSnapshots(id SpanID) []SpanSnapshot
func (*DB) Temporality ¶ added in v0.13.6
func (db *DB) Temporality(sdkmetric.InstrumentKind) metricdata.Temporality
func (*DB) UpdatedSnapshots ¶ added in v0.15.0
func (db *DB) UpdatedSnapshots(filter map[SpanID]bool) []SpanSnapshot
type DBLogExporter ¶
type DBLogExporter struct {
*DB
}
type DBMetricExporter ¶ added in v0.13.6
type DBMetricExporter struct {
*DB
}
func (DBMetricExporter) Export ¶ added in v0.13.6
func (db DBMetricExporter) Export(ctx context.Context, resourceMetrics *metricdata.ResourceMetrics) error
type FrontendOpts ¶
type FrontendOpts struct { // Debug tells the frontend to show everything and do one big final render. Debug bool // Silent tells the frontend to not display progress at all. Silent bool // Verbosity is the level of detail to show in the TUI. Verbosity int // Don't show things that completed beneath this duration. (default 100ms) TooFastThreshold time.Duration // Remove completed things after this duration. (default 1s) GCThreshold time.Duration // Open web browser with the trace URL as soon as pipeline starts. OpenWeb bool // Leave the TUI running instead of exiting after completion. NoExit bool // Run a custom function on exit. CustomExit func() // DotOutputFilePath is the path to write the DOT output to after execution, if any DotOutputFilePath string // DotFocusField is the field name to focus on in the DOT output, if any DotFocusField string // DotShowInternal indicates whether to include internal steps in the DOT output DotShowInternal bool // ZoomedSpan configures a span to be zoomed in on, revealing // its child spans. ZoomedSpan SpanID // FocusedSpan is the currently selected span, i.e. the cursor position. FocusedSpan SpanID // SpanVerbosity tracks per-span verbosity. SpanVerbosity map[SpanID]int // Filter is applied while constructing the tree. Filter func(*Span) WalkDecision }
func (FrontendOpts) ShouldShow ¶
func (opts FrontendOpts) ShouldShow(db *DB, span *Span) bool
type OrderedSet ¶ added in v0.15.0
type OrderedSet[K, V comparable] struct { Order []V KeyFunc func(V) K LessFunc func(V, V) bool Map map[K]V }
func NewOrderedSet ¶ added in v0.15.0
func NewOrderedSet[K comparable, V comparable](keyFunc func(V) K, vs ...V) *OrderedSet[K, V]
func NewSet ¶ added in v0.15.0
func NewSet[T comparable]() *OrderedSet[T, T]
func NewSpanSet ¶ added in v0.15.0
func NewSpanSet(spans ...*Span) *OrderedSet[SpanID, *Span]
func (*OrderedSet[K, V]) Add ¶ added in v0.15.0
func (set *OrderedSet[K, V]) Add(value V) bool
func (*OrderedSet[K, V]) Clear ¶ added in v0.15.0
func (set *OrderedSet[K, V]) Clear()
func (*OrderedSet[K, V]) Iter ¶ added in v0.16.2
func (set *OrderedSet[K, V]) Iter() iter.Seq[V]
func (*OrderedSet[K, V]) MarshalJSON ¶ added in v0.15.0
func (set *OrderedSet[K, V]) MarshalJSON() ([]byte, error)
func (*OrderedSet[K, V]) Remove ¶ added in v0.15.0
func (set *OrderedSet[K, V]) Remove(value V) bool
func (*OrderedSet[K, V]) UnmarshalJSON ¶ added in v0.15.0
func (set *OrderedSet[K, V]) UnmarshalJSON(p []byte) error
type Span ¶
type Span struct { SpanSnapshot ParentSpan *Span `json:"-"` ChildSpans SpanSet `json:"-"` RunningSpans SpanSet `json:"-"` FailedLinks SpanSet `json:"-"` RevealedSpans SpanSet `json:"-"` // Indicates that this span was actually exported to the database, and not // just allocated due to a span parent or other relationship. Received bool // contains filtered or unexported fields }
func (*Span) CachedReason ¶ added in v0.15.0
func (*Span) CanceledReason ¶ added in v0.15.0
func (*Span) CausalSpans ¶ added in v0.15.0
CausalSpans iterates over the spans that directly cause this span, by following links (for newer engines) or attributes (for old engines).
func (*Span) EffectSpans ¶
func (*Span) EndTimeOrFallback ¶
func (*Span) EndTimeOrNow ¶ added in v0.15.0
func (*Span) Errors ¶ added in v0.15.0
Errors returns the individual errored spans contributing to the span's Failed or CausedFailure status.
func (*Span) FailedReason ¶ added in v0.15.0
func (*Span) Hidden ¶ added in v0.15.0
func (span *Span) Hidden(opts FrontendOpts) bool
func (*Span) IsCanceled ¶ added in v0.15.0
func (*Span) IsFailedOrCausedFailure ¶ added in v0.15.0
func (*Span) IsInternal ¶
func (*Span) IsRunningOrEffectsRunning ¶ added in v0.15.0
func (*Span) Matches ¶ added in v0.15.0
Matches returns true if the span matches the filter, looking through Passthrough span parents until a match is found or a non-Passthrough span is reached.
func (*Span) PendingReason ¶ added in v0.15.0
func (*Span) PropagateStatusToParentsAndLinks ¶ added in v0.15.0
func (span *Span) PropagateStatusToParentsAndLinks()
PropagateStatusToParentsAndLinks updates the running and failed state of all parent spans, linked spans, and their parents to reflect the span.
NOTE: failed state only propagates to spans that installed the current span's effect - it does _not_ propagate through the parent span.
func (*Span) Snapshot ¶ added in v0.15.0
func (span *Span) Snapshot() SpanSnapshot
Snapshot returns a snapshot of the span's current state.
func (*Span) VisibleParent ¶ added in v0.15.0
func (span *Span) VisibleParent(opts FrontendOpts) *Span
type SpanContext ¶ added in v0.15.0
type SpanID ¶ added in v0.15.0
func (SpanID) MarshalJSON ¶ added in v0.15.0
func (*SpanID) UnmarshalJSON ¶ added in v0.15.0
type SpanSet ¶ added in v0.15.0
type SpanSet = *OrderedSet[SpanID, *Span]
type SpanSnapshot ¶ added in v0.15.0
type SpanSnapshot struct { // Monotonically increasing number for each update seen for this span. Version int // Indicates that this snapshot is in its final state and should be trusted // over any state derived from the local state. // This is used for snapshots that come from a remote server. Final bool ID SpanID Name string StartTime time.Time EndTime time.Time Activity Activity `json:",omitempty"` ParentID SpanID `json:",omitempty"` Links []SpanContext `json:",omitempty"` Status sdktrace.Status `json:",omitempty"` // statuses derived from span and its effects Failed_ bool `json:",omitempty"` FailedReason_ []string `json:",omitempty"` Cached_ bool `json:",omitempty"` CachedReason_ []string `json:",omitempty"` Pending_ bool `json:",omitempty"` PendingReason_ []string `json:",omitempty"` Canceled_ bool `json:",omitempty"` CanceledReason_ []string `json:",omitempty"` // statuses reported by the span via attributes Canceled bool `json:",omitempty"` Cached bool `json:",omitempty"` // UI preferences reported by the span, or applied to it (sync=>passthrough) Internal bool `json:",omitempty"` Encapsulate bool `json:",omitempty"` Encapsulated bool `json:",omitempty"` Passthrough bool `json:",omitempty"` Ignore bool `json:",omitempty"` Reveal bool `json:",omitempty"` ActorEmoji string `json:",omitempty"` Message string `json:",omitempty"` Inputs []string `json:",omitempty"` Output string `json:",omitempty"` EffectID string `json:",omitempty"` EffectIDs []string `json:",omitempty"` EffectsCompleted []string `json:",omitempty"` CallDigest string `json:",omitempty"` CallPayload string `json:",omitempty"` ChildCount int `json:",omitempty"` HasLogs bool `json:",omitempty"` }
func (*SpanSnapshot) ProcessAttribute ¶ added in v0.15.0
func (snapshot *SpanSnapshot) ProcessAttribute(name string, val any)
type TraceID ¶ added in v0.15.0
func (TraceID) MarshalJSON ¶ added in v0.15.0
func (*TraceID) UnmarshalJSON ¶ added in v0.15.0
type TraceRow ¶
type TraceRow struct { Index int Span *Span Chained bool Depth int IsRunningOrChildRunning bool Previous *TraceRow Parent *Span HasChildren bool }
TraceRow is the flattened representation of the tree so we can easily walk it backwards and render only the parts that will fit on screen. Otherwise large traces get giga slow.
type TraceTree ¶
type WalkDecision ¶ added in v0.16.2
type WalkDecision int
const ( WalkContinue WalkDecision = iota WalkSkip WalkPassthrough WalkStop )