Documentation
¶
Overview ¶
Package monitor owns the probe loop and flusher.
Index ¶
- type Config
- type CycleEvent
- type Monitor
- func (*Monitor) AddDynamicGatewayProbe(existing []probes.Probe) []probes.Probe
- func (m *Monitor) Config() Config
- func (m *Monitor) Run(ctx context.Context)
- func (m *Monitor) SetOnCycle(fn func(CycleEvent))
- func (m *Monitor) SetProbes(probeList []probes.Probe)
- func (m *Monitor) UpdateConfig(cfg Config)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
PingIntervalSec float64
FlushIntervalSec int
PingTimeoutMs int
WifiSampleEnabled bool
}
Config bundles the runtime knobs read from app_config.
type CycleEvent ¶
type CycleEvent struct {
TSUnixMs int64 `json:"ts_unix_ms"`
Total int `json:"total"`
OK int `json:"ok"`
Fail int `json:"fail"`
Results []probes.Result `json:"results"`
}
CycleEvent is emitted after every probe cycle.
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor runs the probe loop and flusher. Config is hot-reloadable via UpdateConfig; subscribers wake on change and re-read at the top of each iteration.
func (*Monitor) AddDynamicGatewayProbe ¶
AddDynamicGatewayProbe prepends a `router_icmp` probe pointed at the auto-detected default gateway. The gateway is resolved fresh on each startup — never persisted, since it changes with networks / DHCP.
func (*Monitor) SetOnCycle ¶
func (m *Monitor) SetOnCycle(fn func(CycleEvent))
SetOnCycle registers a per-cycle callback. Not thread-safe; call once before Run.
func (*Monitor) UpdateConfig ¶
UpdateConfig replaces the running config and wakes all subscribers.