idtui

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 31 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorProfile added in v0.11.1

func ColorProfile() termenv.Profile

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 DumpID added in v0.11.5

func DumpID(out *termenv.Output, id *call.ID) error

DumpID is exposed for troubleshooting.

func NewOutput added in v0.11.1

func NewOutput(w io.Writer, opts ...termenv.OutputOption) *termenv.Output

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/).

func WalkSteps added in v0.9.9

func WalkSteps(spans []*Span, f func(*TraceRow))

Types

type DB added in v0.9.9

type DB struct {
	PrimarySpan trace.SpanID
	PrimaryLogs map[trace.SpanID][]*sdklog.LogData

	Traces   map[trace.TraceID]*Trace
	Spans    map[trace.SpanID]*Span
	Children map[trace.SpanID]map[trace.SpanID]struct{}

	Calls     map[string]*callpbv1.Call
	Outputs   map[string]map[string]struct{}
	OutputOf  map[string]map[string]struct{}
	Intervals map[string]map[time.Time]*Span
}

func NewDB added in v0.9.9

func NewDB() *DB

func (*DB) AllTraces added in v0.11.0

func (db *DB) AllTraces() []*Trace

func (*DB) Close added in v0.9.9

func (*DB) Close() error

func (*DB) ExportLogs added in v0.11.0

func (db *DB) ExportLogs(ctx context.Context, logs []*sdklog.LogData) error

func (*DB) ExportSpans added in v0.11.0

func (db *DB) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error

func (*DB) HighLevelSpan added in v0.11.0

func (db *DB) HighLevelSpan(call *callpbv1.Call) *Span

func (*DB) MostInterestingSpan added in v0.11.0

func (db *DB) MostInterestingSpan(dig string) *Span

func (*DB) MustCall added in v0.11.0

func (db *DB) MustCall(dig string) *callpbv1.Call

func (*DB) PrimarySpanForTrace added in v0.11.0

func (db *DB) PrimarySpanForTrace(traceID trace.TraceID) *Span

func (*DB) SetPrimarySpan added in v0.11.0

func (db *DB) SetPrimarySpan(span trace.SpanID)

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) Shutdown added in v0.11.0

func (db *DB) Shutdown(ctx context.Context) error

func (*DB) Simplify added in v0.9.9

func (db *DB) Simplify(call *callpbv1.Call) (smallest *callpbv1.Call)

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

	// Can consume otel spans and logs.
	sdktrace.SpanExporter
	sdklog.LogExporter

	// ConnectedToEngine is called when the CLI connects to an engine.
	ConnectedToEngine(name string, version string)
	// ConnectedToCloud is called when the CLI has started emitting events to The Cloud.
	ConnectedToCloud(url string)
}

func New

func New() Frontend

func NewPlain added in v0.11.5

func NewPlain() Frontend

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
}

type LogsView added in v0.10.0

type LogsView struct {
	Primary *Span
	Body    []*TraceRow
}

func CollectLogsView added in v0.10.0

func CollectLogsView(rows []*TraceRow) *LogsView

type Pipeline added in v0.9.9

type Pipeline []*TraceRow

func CollectPipelines added in v0.10.0

func CollectPipelines(rows []*TraceRow) []Pipeline

type Span added in v0.9.9

type Span struct {
	sdktrace.ReadOnlySpan

	Digest string

	Call *callpbv1.Call

	Internal bool
	Cached   bool
	Canceled bool
	Inputs   []string

	Primary      bool
	Encapsulate  bool
	Encapsulated bool
	Mask         bool
	Passthrough  bool
	Ignore       bool
	// contains filtered or unexported fields
}

func CollectSpans added in v0.11.0

func CollectSpans(db *DB, traceID trace.TraceID) []*Span

func (*Span) Bar added in v0.9.9

func (span *Span) Bar() SpanBar

func (*Span) Base added in v0.11.0

func (span *Span) Base() (*callpbv1.Call, bool)

func (*Span) Children added in v0.11.0

func (span *Span) Children() []*Span

func (*Span) Classes added in v0.11.0

func (span *Span) Classes() string

func (*Span) Duration added in v0.9.9

func (span *Span) Duration() time.Duration

func (*Span) EndTime added in v0.11.0

func (span *Span) EndTime() time.Time

func (*Span) Err added in v0.11.0

func (span *Span) Err() error

func (*Span) IsBefore added in v0.11.0

func (span *Span) IsBefore(other *Span) bool

func (*Span) IsInternal added in v0.11.0

func (span *Span) IsInternal() bool

func (*Span) IsRunning added in v0.11.0

func (span *Span) IsRunning() bool

func (*Span) Name added in v0.11.0

func (span *Span) Name() string

type SpanBar added in v0.11.0

type SpanBar struct {
	Span          *Span
	Duration      time.Duration
	OffsetPercent float64
	WidthPercent  float64
}

func (SpanBar) Render added in v0.11.0

func (bar SpanBar) Render() templ.Component

type Task added in v0.11.0

type Task struct {
	Span      sdktrace.ReadOnlySpan
	Name      string
	Current   int64
	Total     int64
	Started   time.Time
	Completed time.Time
}

type Trace added in v0.11.0

type Trace struct {
	ID         trace.TraceID
	Epoch, End time.Time
	IsRunning  bool
	// contains filtered or unexported fields
}

func (*Trace) HexID added in v0.11.0

func (trace *Trace) HexID() string

func (*Trace) Name added in v0.11.0

func (trace *Trace) Name() string

func (*Trace) PrimarySpan added in v0.11.0

func (trace *Trace) PrimarySpan() *Span

type TraceRow added in v0.9.9

type TraceRow struct {
	Span *Span

	Parent *TraceRow

	IsRunning bool
	Chained   bool

	Children  []*TraceRow
	Collapsed bool
}

func CollectRows added in v0.9.9

func CollectRows(steps []*Span) []*TraceRow

func (*TraceRow) Depth added in v0.9.9

func (row *TraceRow) Depth() int

type Vterm added in v0.9.9

type Vterm struct {
	Offset int
	Height int
	Width  int

	Prefix string
	// contains filtered or unexported fields
}

func NewVterm added in v0.9.9

func NewVterm() *Vterm

func (*Vterm) Init added in v0.9.9

func (term *Vterm) Init() tea.Cmd

func (*Vterm) LastLine added in v0.9.9

func (term *Vterm) LastLine() string

LastLine returns the last line of visible text, with ANSI formatting, but without any trailing whitespace.

func (*Vterm) Print added in v0.9.9

func (term *Vterm) Print(w io.Writer) error

Print prints the full log output without any formatting.

func (*Vterm) Render added in v0.9.9

func (term *Vterm) Render(w io.Writer, offset, height int)

Bytes returns the output for the given region of the terminal, with ANSI formatting.

func (*Vterm) ScrollPercent added in v0.9.9

func (term *Vterm) ScrollPercent() float64

func (*Vterm) SetHeight added in v0.9.9

func (term *Vterm) SetHeight(height int)

func (*Vterm) SetPrefix added in v0.9.9

func (term *Vterm) SetPrefix(prefix string)

func (*Vterm) SetWidth added in v0.9.9

func (term *Vterm) SetWidth(width int)

func (*Vterm) Term added in v0.9.9

func (term *Vterm) Term() *midterm.Terminal

func (*Vterm) Update added in v0.9.9

func (term *Vterm) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Vterm) UsedHeight added in v0.9.9

func (term *Vterm) UsedHeight() int

func (*Vterm) View added in v0.9.9

func (term *Vterm) View() string

View returns the output for the current region of the terminal, with ANSI formatting.

func (*Vterm) Write added in v0.9.9

func (term *Vterm) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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