startuptrace

package
v0.89.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package startuptrace records how long each phase of sidecar's startup takes.

Startup latency is dominated by work that happens before Bubble Tea paints the first frame. On machines with an endpoint security agent (CrowdStrike Falcon and friends) every file open and every process spawn is intercepted, so work that is cheap on a developer laptop can cost seconds elsewhere. This package makes that cost visible.

Tracing is off unless SIDECAR_STARTUP_TRACE is set. Set it to "1" to write the report to the debug log, or to "stderr" to also print it to stderr on exit (useful when running sidecar under tmux capture).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Begin

func Begin(name string) func()

Begin returns a function that records the elapsed time when called. Use it when the work is not conveniently wrappable in a closure:

defer startuptrace.Begin("phase")()

func Count

func Count(name string)

Count increments a named counter (e.g. subprocess spawns).

func Enabled

func Enabled() bool

Enabled reports whether tracing is active.

func Mark

func Mark(name string)

Mark records a zero-length event at the current offset from process start.

func Report

func Report(logger *slog.Logger)

Report writes the collected spans to the logger (and stderr when the trace env var is "stderr"). Safe to call when tracing is disabled.

func ReportDelay

func ReportDelay() time.Duration

ReportDelay is how long after startup the trace should be dumped, so that async work started during boot is included. Override with SIDECAR_STARTUP_TRACE_DELAY (a Go duration, e.g. "20s").

func Track

func Track(name string, fn func())

Track times fn and records it under name. It always calls fn.

Types

This section is empty.

Jump to

Keyboard shortcuts

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