Documentation ¶
Index ¶
- Constants
- Variables
- func ColorProfile() termenv.Profile
- func NewOutput(w io.Writer, opts ...termenv.OutputOption) *termenv.Output
- type DB
- func (db *DB) AllTraces() []*Trace
- func (*DB) Close() error
- func (db *DB) CollectTree(spans []*Span) []*TraceTree
- func (db *DB) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error
- func (db *DB) ForceFlush(ctx context.Context) error
- func (db *DB) HighLevelSpan(call *callpbv1.Call) *Span
- func (db *DB) LogExporter() sdklog.Exporter
- func (db *DB) MostInterestingSpan(dig string) *Span
- func (db *DB) MustCall(dig string) *callpbv1.Call
- func (db *DB) RowsView(zoomedID trace.SpanID) *RowsView
- func (db *DB) SetPrimarySpan(span trace.SpanID)
- func (db *DB) Shutdown(ctx context.Context) error
- func (db *DB) Simplify(call *callpbv1.Call, force bool) (smallest *callpbv1.Call)
- func (db *DB) WalkSpans(spans []*Span, f func(*TraceTree))
- type DBLogExporter
- type Dump
- type Frontend
- type FrontendOpts
- type FrontendSpanExporter
- func (fe FrontendSpanExporter) Background(cmd tea.ExecCommand) error
- func (fe FrontendSpanExporter) Close() error
- func (fe FrontendSpanExporter) ConnectedToEngine(ctx context.Context, name string, version string, clientID string)
- func (fe FrontendSpanExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error
- func (fe FrontendSpanExporter) ForceFlush(context.Context) error
- func (fe FrontendSpanExporter) Init() tea.Cmd
- func (fe FrontendSpanExporter) LogExporter() sdklog.Exporter
- func (fe FrontendSpanExporter) Render(out *termenv.Output) error
- func (fe FrontendSpanExporter) Run(ctx context.Context, opts FrontendOpts, run func(context.Context) error) error
- func (fe FrontendSpanExporter) SetCloudURL(ctx context.Context, url string, msg string, logged bool)
- func (fe FrontendSpanExporter) SetPrimary(spanID trace.SpanID)
- func (fe FrontendSpanExporter) SetRevealAllSpans(val bool)
- func (fe FrontendSpanExporter) Shutdown(ctx context.Context) error
- func (fe FrontendSpanExporter) SpanExporter() sdktrace.SpanExporter
- func (fe FrontendSpanExporter) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (fe FrontendSpanExporter) View() string
- type Rows
- type RowsView
- type Span
- func (span *Span) ActiveDuration(fallbackEnd time.Time) time.Duration
- func (span *Span) Bar() SpanBar
- func (span *Span) ChildrenAndEffects() []*Span
- func (span *Span) Classes() string
- func (span *Span) EffectSpans() []*Span
- func (span *Span) EndTime() time.Time
- func (span *Span) EndTimeOrFallback(fallbackEnd time.Time) time.Time
- func (span *Span) Err() error
- func (span *Span) Failed() bool
- func (span *Span) HasParent(parent *Span) bool
- func (span *Span) IsBefore(other *Span) bool
- func (span *Span) IsInternal() bool
- func (span *Span) IsRunning() bool
- func (span *Span) Name() string
- func (span *Span) SelfDuration(fallbackEnd time.Time) time.Duration
- type SpanActivity
- type SpanBar
- type Task
- type Trace
- type TraceRow
- type TraceTree
- type Vterm
- func (term *Vterm) Init() tea.Cmd
- func (term *Vterm) LastLine() string
- func (term *Vterm) Print(w io.Writer) error
- func (term *Vterm) Render(w io.Writer, offset, height int)
- func (term *Vterm) ScrollPercent() float64
- func (term *Vterm) SetHeight(height int)
- func (term *Vterm) SetPrefix(prefix string)
- func (term *Vterm) SetWidth(width int)
- func (term *Vterm) Term() *midterm.Terminal
- func (term *Vterm) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (term *Vterm) UsedHeight() int
- func (term *Vterm) View() string
- func (term *Vterm) Write(p []byte) (int, error)
Constants ¶
const ( HideCompletedVerbosity = 0 ShowCompletedVerbosity = 1 ExpandCompletedVerbosity = 2 ShowInternalVerbosity = 3 ShowEncapsulatedVerbosity = 3 ShowSpammyVerbosity = 4 ShowDigestsVerbosity = 4 )
const ( Block = "█" CaretDownEmpty = "▽" CaretDownFilled = "▼" CaretLeftFilled = "◀" // "<" CaretRightEmpty = "▷" // ">" CaretRightFilled = "▶" // ">" CornerBottomLeft = "╰" CornerBottomRight = "╯" CornerTopLeft = "╭" CornerTopRight = "╮" CrossBar = "┼" DotEmpty = "○" DotFilled = "●" HorizBar = "─" HorizBottomBar = "┬" HorizHalfLeftBar = "╴" HorizHalfRightBar = "╶" HorizTopBar = "┴" HorizTopBoldBar = "┻" InactiveGroupSymbol = VertBar TaskSymbol = VertRightBoldBar VertBar = "│" VertBoldBar = "┃" VertDottedBar = "┊" // ┊┆┇┋╎ VertLeftBar = "┤" VertLeftBoldBar = "┫" VertRightBar = "├" VertRightBoldBar = "┣" IconSkipped = "∅" IconSuccess = "✔" IconFailure = "✘" )
Variables ¶
var KeymapStyle = lipgloss.NewStyle(). Foreground(lipgloss.ANSIColor(termenv.ANSIBrightBlack))
Functions ¶
func ColorProfile ¶ added in v0.11.1
ColorProfile returns Ascii if, and only if, NO_COLOR or similar is set. Otherwise it returns termenv.ANSI, allowing colors to be used.
Note that color profiles beyond simple ANSI are not used by Progrock. 16 colors is all you need. Anything else disrespects the user's color scheme preferences.
func NewOutput ¶ added in v0.11.1
NewOutput returns a termenv.Output that will always use color, regardless of whether w is a TTY, unless NO_COLOR is explicitly set.
Progrock is opinionated here. Termenv disables colors by default if stdout is not a TTY or if the CI env var is set. We don't want that, because folks deserve colorful output in CI too.
To disable colors, set NO_COLOR (https://no-color.org/).
Types ¶
type DB ¶ added in v0.9.9
type DB struct { PrimarySpan trace.SpanID PrimaryLogs map[trace.SpanID][]sdklog.Record Traces map[trace.TraceID]*Trace Spans map[trace.SpanID]*Span SpanOrder []*Span Children map[trace.SpanID]map[trace.SpanID]struct{} ChildrenOrder map[trace.SpanID][]trace.SpanID Calls map[string]*callpbv1.Call Outputs map[string]map[string]struct{} OutputOf map[string]map[string]struct{} Intervals map[string]map[time.Time]*Span Effects map[string]*Span EffectSite map[string]*Span }
func (*DB) CollectTree ¶ added in v0.12.0
func (*DB) ExportSpans ¶ added in v0.11.0
func (*DB) LogExporter ¶ added in v0.11.7
func (*DB) MostInterestingSpan ¶ added in v0.11.0
func (*DB) SetPrimarySpan ¶ added in v0.11.0
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.
type DBLogExporter ¶ added in v0.11.7
type DBLogExporter struct {
*DB
}
type Frontend ¶
type Frontend interface { // Run starts a frontend, and runs the target function. Run(ctx context.Context, opts FrontendOpts, f func(context.Context) error) error // SetPrimary tells the frontend which span should be treated like the focal // point of the command. Its output will be displayed at the end, and its // children will be promoted to the "top-level" of the TUI. SetPrimary(spanID trace.SpanID) Background(cmd tea.ExecCommand) error // RevealAllSpans tells the frontend to show all spans, not just the spans // beneath the primary span. SetRevealAllSpans(bool) // Can consume otel spans and logs. SpanExporter() sdktrace.SpanExporter LogExporter() sdklog.Exporter // ConnectedToEngine is called when the CLI connects to an engine. ConnectedToEngine(ctx context.Context, name string, version string, clientID string) // SetCloudURL is called after the CLI checks auth and sets the cloud URL. SetCloudURL(ctx context.Context, url string, msg string, logged bool) }
type FrontendOpts ¶ added in v0.11.5
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 // RevealAllSpans tells the frontend to show all spans, not just the spans // beneath the primary span. RevealAllSpans bool }
func (FrontendOpts) ShouldShow ¶ added in v0.12.0
func (opts FrontendOpts) ShouldShow(tree *TraceTree) bool
type FrontendSpanExporter ¶ added in v0.11.7
type FrontendSpanExporter struct {
// contains filtered or unexported fields
}
func (FrontendSpanExporter) Background ¶ added in v0.11.7
func (fe FrontendSpanExporter) Background(cmd tea.ExecCommand) error
func (FrontendSpanExporter) ConnectedToEngine ¶ added in v0.11.7
func (FrontendSpanExporter) ExportSpans ¶ added in v0.11.7
func (fe FrontendSpanExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error
func (FrontendSpanExporter) ForceFlush ¶ added in v0.11.7
func (FrontendSpanExporter) LogExporter ¶ added in v0.11.7
func (FrontendSpanExporter) Run ¶ added in v0.11.7
func (fe FrontendSpanExporter) Run(ctx context.Context, opts FrontendOpts, run func(context.Context) error) error
Run starts the TUI, calls the run function, stops the TUI, and finally prints the primary output to the appropriate stdout/stderr streams.
func (FrontendSpanExporter) SetCloudURL ¶ added in v0.12.0
func (FrontendSpanExporter) SetPrimary ¶ added in v0.11.7
func (FrontendSpanExporter) SetRevealAllSpans ¶ added in v0.12.5
func (fe FrontendSpanExporter) SetRevealAllSpans(val bool)
func (FrontendSpanExporter) SpanExporter ¶ added in v0.11.7
func (fe FrontendSpanExporter) SpanExporter() sdktrace.SpanExporter
type RowsView ¶ added in v0.11.7
func (*RowsView) Rows ¶ added in v0.12.0
func (lv *RowsView) Rows(opts FrontendOpts) *Rows
type Span ¶ added in v0.9.9
type Span struct { sdktrace.ReadOnlySpan ParentSpan *Span ChildSpans []*Span ID trace.SpanID IsSelfRunning bool Digest string Call *callpbv1.Call Base *callpbv1.Call Internal bool Cached bool Canceled bool EffectID string Inputs []string Effects []string RunningEffects map[string]*Span FailedEffects map[string]*Span Encapsulate bool Encapsulated bool Mask bool Passthrough bool Ignore bool // contains filtered or unexported fields }
func (*Span) ActiveDuration ¶ added in v0.12.0
func (*Span) ChildrenAndEffects ¶ added in v0.12.0
func (*Span) EffectSpans ¶ added in v0.12.0
func (*Span) EndTimeOrFallback ¶ added in v0.12.0
func (*Span) IsInternal ¶ added in v0.11.0
type SpanActivity ¶ added in v0.12.0
type SpanBar ¶ added in v0.11.0
type Trace ¶ added in v0.11.0
type TraceRow ¶ added in v0.9.9
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 ¶ added in v0.12.0
type Vterm ¶ added in v0.9.9
type Vterm struct { Offset int Height int Width int Prefix string // contains filtered or unexported fields }
func (*Vterm) LastLine ¶ added in v0.9.9
LastLine returns the last line of visible text, with ANSI formatting, but without any trailing whitespace.
func (*Vterm) Render ¶ added in v0.9.9
Bytes returns the output for the given region of the terminal, with ANSI formatting.