F-03: Observability slog + Prometheus (bookshelf-qqz.3) #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bd-bookshelf-qqz.3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds
internal/observability(F-03 of the Foundation epic bookshelf-qqz):NewLogger(w io.Writer, format, level string) (*slog.Logger, error)— json|text handler, levels debug/info/warn/error (case-insensitive, "warning" alias, empty defaults to info). Errors on unknown values.NewRegistry() *prometheus.Registry— a fresh registry (NOT the default — avoids ginkgo cross-test pollution) with Go runtime + process collectors pre-registered.MetricsHandler(reg) http.Handler—promhttp.HandlerForwrapping the registry.NewTraceID() string— 10 bytes fromcrypto/randencoded as 16-char base32 (no padding). Panics on RNG failure (unrecoverable).Takes simple primitives, not config types — main.go wiring lives in a later bead.
Test plan
go vet ./internal/observability/...passesgo test -race ./internal/observability/...passesinternal/observabilityCloses bead bookshelf-qqz.3 on merge.
16e9d932efto4dd228deae