Documentation
¶
Index ¶
- Constants
- Variables
- func Available() []string
- type BuilderWithFlags
- type Collection
- func (c *Collection) Build(ctx context.Context, logger *slog.Logger) error
- func (c *Collection) Close()
- func (c *Collection) Collect(ch chan<- prometheus.Metric, logger *slog.Logger, ...)
- func (c *Collection) Collectors() []string
- func (c *Collection) Describe(ch chan<- *prometheus.Desc)
- func (c *Collection) Enable(collectors []string) error
- func (c *Collection) NewHandler(maxScrapeDuration time.Duration, logger *slog.Logger, collectors []string) (*Handler, error)
- type Collector
- type Config
- type Handler
- type Map
Constants ¶
const DefaultCollectors = "cpu,memory,net,pagefile"
Variables ¶
var BuildersWithFlags = map[string]BuilderWithFlags[Collector]{ cpu.Name: NewBuilderWithFlags(cpu.NewWithFlags), memory.Name: NewBuilderWithFlags(memory.NewWithFlags), net.Name: NewBuilderWithFlags(net.NewWithFlags), pagefile.Name: NewBuilderWithFlags(pagefile.NewWithFlags), }
var ConfigDefaults = Config{ CPU: cpu.ConfigDefaults, Memory: memory.ConfigDefaults, Net: net.ConfigDefaults, Pagefile: pagefile.ConfigDefaults, }
Functions ¶
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) 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)