Documentation ¶
Index ¶
- Variables
- type MetricSet
- type MetricSeter
- type Module
- type ModuleConfig
- type Moduler
- type Register
- func (r *Register) AddMetricSeter(module string, name string, factory func() MetricSeter) error
- func (r *Register) AddModuler(name string, factory func() Moduler) error
- func (r *Register) GetMetricSet(module *Module, name string) (*MetricSet, error)
- func (r *Register) GetModule(cfg *common.Config) (*Module, error)
- func (r Register) String() string
Constants ¶
This section is empty.
Variables ¶
var Registry = Register{}
Registry is the singleton Register instance where all modules and metricsets should register their factories.
Functions ¶
This section is empty.
Types ¶
type MetricSet ¶
type MetricSet struct { Name string MetricSeter MetricSeter // Inherits config from module Config ModuleConfig Module *Module // contains filtered or unexported fields }
Metric specific data This must be defined by each metric
func NewMetricSet ¶
func NewMetricSet(name string, new func() MetricSeter, module *Module) (*MetricSet, error)
Creates a new MetricSet
type MetricSeter ¶
type MetricSeter interface { // Setup of MetricSeter // MetricSet which contains the MetricSeter is passed. This gives access to config // and the module. Setup(ms *MetricSet) error // Method to periodically fetch a new event from a host // Fetch is called for each host. In case where host does not exist, it can be transferred // differently in the setup to have a different meaning. An example here is for filesystem // of topbeat, where each host could be a filesystem. // Fetch is called on the predefined interval and does not take delays into account. Fetch(ms *MetricSet, host string) (common.MapStr, error) }
Interface for each metric
type Module ¶
type Module struct { // Module config Config ModuleConfig Timeout time.Duration Publish chan common.MapStr // contains filtered or unexported fields }
Module specifics. This must be defined by each module
func (*Module) FetchMetricSets ¶
func (*Module) ProcessConfig ¶
ProcessConfig allows to process additional configuration params which are not part of the module default configuratoin. This allows each metricset to have its specific config params
type ModuleConfig ¶
type ModuleConfig struct { Hosts []string `config:"hosts"` Period string `config:"period"` Timeout string `config:"timeout"` Module string `config:"module"` MetricSets []string `config:"metricsets"` Enabled bool `config:"enabled"` Filters []filter.FilterConfig `config:"filters"` common.EventMetadata `config:",inline"` // Fields and tags to add to events. }
Base configuration for each module/metricsets combination
type Moduler ¶
type Moduler interface { // Raw *common.Config config is passed. This allows each module to extract its own local config variables Setup(m *Module) error }
Interface for each module
type Register ¶
type Register struct { Modulers map[string]func() Moduler // A map of module name to Moduler factory function. MetricSeters map[string]map[string]func() MetricSeter // A map of module name to nested map of metricset name to MetricSeter factory function. }
Register contains the factory functions for creating new Modulers and new MetricSeters.
func (*Register) AddMetricSeter ¶
func (r *Register) AddMetricSeter(module string, name string, factory func() MetricSeter) error
AddMetricSeter registers a new MetricSeter factory. An error is returned if any parameter is empty or nil or if a factory has already been registered under the name.
func (*Register) AddModuler ¶
AddModuler registers a new Moduler factory. An error is returned if the name is empty, factory is nil, or if a factory has already been registered under the name.
func (*Register) GetMetricSet ¶
GetMetricSet returns a new MetricSet instance given the module and metricset name. An error is returned if the module or metricset do not exist.