collector

package
v0.0.0-...-170f90c Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package collector reads Netdata-compatible OS metrics from procfs and sysfs and feeds them into the shared metrics registry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector interface {
	Name() string
	Init(reg metrics.Registry, prefix string)
	Collect() error
}

Collector reads OS metrics from procfs/sysfs and updates Prometheus gauges. Init is called once at startup to create metric handles. Collect is called on every tick to read current values and update those handles.

type CollectorOverride

type CollectorOverride struct {
	Enabled  bool
	Interval time.Duration
}

CollectorOverride holds per-collector config from YANG. Zero Interval means inherit the global interval.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager runs all registered collectors on a configurable tick interval, feeding Netdata-compatible Prometheus metrics into the shared registry.

func NewManager

func NewManager(reg metrics.Registry, prefix string, interval time.Duration, logger *slog.Logger) *Manager

NewManager creates a Manager that will register metrics on reg with the given name prefix (default "netdata") and collect at the given interval.

func StartOSCollectors

func StartOSCollectors(reg metrics.Registry, prefix string, interval time.Duration, overrides map[string]CollectorOverride, logger *slog.Logger) *Manager

StartOSCollectors creates a Manager with all platform-specific OS collectors and starts collection. Per-collector overrides control enable/disable and interval. Returns the Manager so callers can call Stop() on shutdown; returns nil if no collectors are available.

func (*Manager) Register

func (m *Manager) Register(c Collector)

Register adds a collector to the manager. Must be called before Start.

func (*Manager) Start

func (m *Manager) Start()

Start initializes enabled collectors and begins the collection loop.

func (*Manager) Stop

func (m *Manager) Stop()

Stop signals the collection loop to exit and waits for it to finish.

Jump to

Keyboard shortcuts

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