observability

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package observability provides dependency-free crash capture for the CLI: a recovered panic is written to a local crash report (timestamp, label, stack) and surfaced to the user as a brief notice instead of a raw stack trace. It is the fail-open foundation for remote crash/metrics reporting — a Sentry/OTEL adapter can hook the same Recover/report path when configured — without pulling those dependencies into the base build.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultCrashDir

func DefaultCrashDir() string

DefaultCrashDir is where crash reports are written by default.

func FormatCrashReport

func FormatCrashReport(label string, recovered any, stack []byte, ts time.Time) string

FormatCrashReport renders a human-readable crash report.

func Recover

func Recover(dir, label string, stderr io.Writer, code *int)

Recover is deferred at a top-level entrypoint. On a panic it captures the stack, writes a crash report under dir, prints a brief notice to stderr, and sets *code to a crash exit code. It is fail-open: if the report can't be written it still reports the crash with the stack inline. No panic escapes.

func WriteCrashReport

func WriteCrashReport(dir, label string, recovered any, stack []byte, ts time.Time) (string, error)

WriteCrashReport writes a crash report file into dir and returns its path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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