collector

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const DefaultCollectors = "cpu,memory,net,pagefile"

Variables

View Source
var ConfigDefaults = Config{
	CPU:      cpu.ConfigDefaults,
	Memory:   memory.ConfigDefaults,
	Net:      net.ConfigDefaults,
	Pagefile: pagefile.ConfigDefaults,
}

Functions

func Available

func Available() []string

Available returns a sorted list of available collectors.

Types

type BuilderWithFlags

type BuilderWithFlags[C Collector] func(*kingpin.Application) C

func NewBuilderWithFlags

func NewBuilderWithFlags[C Collector](fn BuilderWithFlags[C]) BuilderWithFlags[Collector]

type Collection

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

func NewCollection

func NewCollection(collectors Map) Collection

NewCollection returns a new windows agent collector collection

func NewWithConfig

func NewWithConfig(config Config) Collection

NewWithConfig returns a new windows agent collector collection with config

func NewWithFlags

func NewWithFlags(app *kingpin.Application) Collection

NewWithFlags returns a new windows agent collector collection with kingpin flags registration

func (*Collection) Build

func (c *Collection) Build(ctx context.Context, logger *slog.Logger) error

Build initializes all collectors in the collection.

func (*Collection) Close

func (c *Collection) Close()

Close closes all collectors in the collection.

func (*Collection) Collect

func (c *Collection) Collect(ch chan<- prometheus.Metric, logger *slog.Logger, maxScrapeDuration time.Duration)

Collect implements prometheus.Collector interface.

func (*Collection) Collectors

func (c *Collection) Collectors() []string

Collectors returns a slice of collector names.

func (*Collection) Describe

func (c *Collection) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector interface.

func (*Collection) Enable

func (c *Collection) Enable(collectors []string) error

Enable enables collectors by name.

func (*Collection) NewHandler

func (c *Collection) NewHandler(maxScrapeDuration time.Duration, logger *slog.Logger, collectors []string) (*Handler, error)

NewHandler returns a new Handler that implements a prometheus.Collector for the given metrics Collection.

type Collector

type Collector interface {
	// GetName get the name of the collector
	GetName() string
	// Build build the collector
	Build(logger *slog.Logger, miSession *mi.Session) error
	// Collect Get new metrics and expose them via prometheus registry.
	Collect(ch chan<- prometheus.Metric) (err error)
	// Close closes the collector
	Close() error
}

Collector interface that a collector has to implement.

type Config

type Config struct {
	CPU      cpu.Config      `yaml:"cpu"`
	Memory   memory.Config   `yaml:"memory"`
	Net      net.Config      `yaml:"net"`
	Pagefile pagefile.Config `yaml:"pagefile"`
}

Config provides configuration for the windows_agent_collector

type Handler

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

Handler implements prometheus.Collector for a set of Windows Collection.

func (*Handler) Collect

func (p *Handler) Collect(ch chan<- prometheus.Metric)

Collect sends the collected metrics from each of the Collection to prometheus.

func (*Handler) Describe

func (p *Handler) Describe(_ chan<- *prometheus.Desc)

type Map

type Map map[string]Collector

Jump to

Keyboard shortcuts

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