Documentation
¶
Overview ¶
Package telemetry provides runtime fencing (P2-4) and the metrics hook exposing runtime/metrics histograms plus the msgbus overflow counters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForceGC ¶
func ForceGC()
ForceGC runs a full garbage collection cycle. It backs the /gc endpoint of the metrics server: with gc_off, operators can trigger collections during declared quiet windows instead of relying on the memory-limit fuse.
func StartMetricsServer ¶
StartMetricsServer serves the observability endpoints on cfg.Addr:
GET /metrics plain-text dump: msgbus drop/wait/unrouted counters and
runtime/metrics gauges + histogram percentiles
(p50/p99/p99.9/max), including /gc/pauses:seconds and
/sched/latencies:seconds.
POST /gc force a garbage collection (quiet-window hook for
gc_off deployments).
The server runs on its own goroutines and never touches the hot path: counters are read with atomic loads on request.
Types ¶
type MetricsConfig ¶
type MetricsConfig struct {
Enabled bool `yaml:"enabled"`
Addr string `yaml:"addr"` // e.g. "127.0.0.1:9100"
}
MetricsConfig configures the metrics HTTP server (P2-4 step 5).
type RuntimeConfig ¶
type RuntimeConfig struct {
// GCOff disables periodic garbage collection (GOGC=off). Refused unless
// a memory limit is in force (config or GOMEMLIMIT), which keeps the GC
// available as a fuse against leaks.
GCOff bool `yaml:"gc_off"`
// MemLimitBytes sets the Go soft memory limit (GOMEMLIMIT).
// 0 leaves the current limit untouched.
MemLimitBytes int64 `yaml:"mem_limit_bytes"`
// GOMAXPROCS caps the number of Ps. 0 leaves the default.
// See docs/DEPLOYMENT.md for sizing guidance.
GOMAXPROCS int `yaml:"gomaxprocs"`
}
RuntimeConfig fences the Go runtime for latency-critical deployments (P2-4). The supported production configuration after the Phase 2 allocation work is gc_off=true with a memory limit: the GC becomes a memory fuse rather than a periodic event, because the hot path allocates nothing in steady state.
The equivalent environment variables (GOGC=off, GOMEMLIMIT, GOMAXPROCS) also work without any of these fields; config wins when both are set because Apply runs after the runtime reads the environment.
func (RuntimeConfig) Apply ¶
func (c RuntimeConfig) Apply() error
Apply installs the runtime fencing. Call once at startup, before engines start.