zombie

package
v0.0.0-...-6ed2b60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

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

func Hunt() (int, error)

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 NewMetrics

func NewMetrics() *Metrics

NewMetrics constructs the zombie instrument bundle.

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

func (m *Metrics) RecordCleaned(n int)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL