Documentation
¶
Overview ¶
Package zombie removes orphan TC telemetry filters left by a previous agent run that exited without unloading them.
The dangerous case is an orphan on a DIFFERENT interface than the new agent attaches to: nothing ever replaces that filter, so the old program keeps running and double-counts the same traffic. (On the same interface the kernel happens to re-use the slot and free the old program, but that is not guaranteed.)
Hunt therefore runs early in Bootstrap, before any new program is loaded, so the orphan's reference is dropped first.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hunt ¶
Hunt enumerates every TC filter the kernel knows about and deletes any whose name matches the agent's own telemetry filters (see tcattach.Hooks). It returns the count of filters successfully deleted.
Hunt is best-effort. Per-link netlink errors during enumeration are expected — most links have no clsact qdisc and FilterList returns an error for them — and are silently skipped. Per-filter FilterDel failures are logged at warn and aggregated into the returned error, but do not abort the scan: a partial cleanup is still safer than no cleanup. Callers should treat the returned error as a hygiene warning, not a fatal startup condition.
Types ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics holds the zombie-subsystem Prometheus instruments. Construct with NewMetrics, register the slice from Metrics.Collectors with the agent's prometheus.Registry, then call Metrics.RecordCleaned once with the count returned by Hunt.
The single instrument is cataloged under health metrics:
- lachesis_zombie_filters_cleaned_total orphan TC filters deleted at startup
Metric catalogue: docs/architecture/metrics.md
func (*Metrics) Collectors ¶
func (m *Metrics) Collectors() []prometheus.Collector
Collectors returns every instrument in the bundle, suitable for passing to prometheus.Registerer.MustRegister.
func (*Metrics) RecordCleaned ¶
RecordCleaned adds n to the cleaned-filters counter. Safe to call with n == 0 and on a nil receiver — the latter lets unit tests drop the metric dependency without writing a stub.