Documentation
¶
Overview ¶
Package runtime wires reload and debug controls onto the agent: the Manager holds the current config, re-reads the YAML on SIGHUP, applies the hot-reloadable fields, and serves /debug.
A field is HOT if changing it rebinds no resource — the logging level plus everything config.Tunables projects. Everything else is LOAD-TIME: listen addresses, paths, log format, and the Neutron/Kafka connection sections. A load-time change in the YAML is warned about and ignored. Pinning is a one-shot boot action, so both bpf knobs are load-time.
docs/operations/runtime.md
Index ¶
- type Manager
- func (m *Manager) Current() config.Config
- func (m *Manager) DebugHandler() http.Handler
- func (m *Manager) InstallSIGHUP(ctx context.Context)
- func (m *Manager) Reload() error
- func (m *Manager) SetMetrics(mx *Metrics)
- func (m *Manager) SetOnReload(fn func())
- func (m *Manager) SetTunables(s *tunables.Store)
- type Metrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns the agent's runtime configuration state. Construct one in main after config.Load and logging.Init, then call Manager.InstallSIGHUP and mount Manager.DebugHandler on the HTTP server.
func New ¶
New creates a Manager seeded with the initial config snapshot. The configPath is the YAML file location; an empty string disables SIGHUP reload while keeping the /debug HTTP endpoints functional.
func (*Manager) Current ¶
Current returns a snapshot of the most recently applied configuration. Safe for concurrent callers.
func (*Manager) DebugHandler ¶
DebugHandler returns the /debug handler: GET /debug/config (secrets redacted) and PUT /debug/log-level. Mount alongside /metrics.
The endpoints are intentionally UNAUTHENTICATED and the default listen address is all-interfaces. Secrets never appear in responses, but /debug also exposes pprof and runtime tuning — on an untrusted network, bind to localhost or firewall the port.
func (*Manager) InstallSIGHUP ¶
InstallSIGHUP installs a handler that calls Manager.Reload on each SIGHUP. The goroutine stops when ctx is cancelled. Safe to call once per process; not concurrency-safe with itself.
func (*Manager) Reload ¶
Reload reads the YAML file and applies hot-reloadable fields. Load-time fields whose YAML value differs from the running value are logged as warnings but not applied; restart is required for those.
Returns an error if the YAML cannot be read or fails validation. The active configuration is left unchanged in that case.
func (*Manager) SetMetrics ¶
SetMetrics wires the reload-outcome counter. Call once during boot.
func (*Manager) SetOnReload ¶
func (m *Manager) SetOnReload(fn func())
SetOnReload wires a hook run after every successful reload — the agent passes the reconciler's Kick so a hot reconcile-interval change (or any operator edit) applies at the NEXT reconcile within seconds, not after the running ticker's current period elapses (which, at a large old interval, would delay it by that whole period). Call once during boot, before Manager.InstallSIGHUP; nil leaves reload hook-free.
func (*Manager) SetTunables ¶
SetTunables wires the shared hot-knob store SIGHUP reloads swap. Call once during boot, before Manager.InstallSIGHUP.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics is the runtime subsystem's instrument bundle: reload outcomes, so a failed SIGHUP (malformed YAML kept the old config running) is observable instead of silent. Registered centrally by the agent like every per-package bundle.
func NewMetrics ¶
func NewMetrics() *Metrics
NewMetrics constructs the bundle and pre-seeds every result label so the series exist before the first reload.
func (*Metrics) Collectors ¶
func (m *Metrics) Collectors() []prometheus.Collector
Collectors returns the bundle's instruments for central registration.
func (*Metrics) RecordReload ¶
RecordReload counts one reload outcome.