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 Mark ¶
func Mark(name string)
Mark records a zero-length event at the current offset from process start.
func Report ¶
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 ¶
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").
Types ¶
This section is empty.