Documentation ¶
Index ¶
Constants ¶
View Source
const ( WarnPercentFieldName = "memory.percent.warn" CriticalPercentFieldName = "memory.percent.critical" ScanIntervalFieldName = "memory.scan_interval" WarnPercentDefault = uint8(60) CriticalPercentDefault = uint8(95) ScanIntervalDefault = time.Second )
Variables ¶
View Source
var Component = &app.Component{ Dependencies: app.Components{ logger.Component, configurator.Component, closer.OsSignalComponent, quota.Component, info.Component, }, Constructor: func(container container.Container) error { return container.Provides( NewConfig, NewReConfigurationWithConfigurator, func(reConfiguration *ReConfiguration) Stater { return reConfiguration }, ) }, BindFlags: func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.Uint8Var(&config.WarnPercent, WarnPercentFieldName, WarnPercentDefault, fmt.Sprintf( "percentage of used memory, after which the value will be set to %s", Warning, )) flagSet.Uint8Var(&config.CriticalPercent, CriticalPercentFieldName, CriticalPercentDefault, fmt.Sprintf( "percentage of used memory, after which the value will be set to %s", Critical, )) flagSet.DurationVar(&config.ScanInterval, ScanIntervalFieldName, ScanIntervalDefault, "timeout between memory scans") }) }, Serve: func(c container.Container) error { stater, err := container.Get[*ReConfiguration](c) if err != nil { return err } closer, err := container.Get[closer.Closer](c) if err != nil { return err } reConfiguration, err := container.Get[configurator.ReConfiguration](c) if err != nil { return err } informer, err := container.Get[logger.Informer](c) if err != nil { return err } reConfiguration.Registration(stater) informer.Info("memoryStater: registration in the reConfigurator") info, err := container.Get[info.Info](c) if err != nil { return err } config, err := container.Get[*Config](c) if err != nil { return err } info.Registration("memory", config) stater.Serve(closer.GetContext()) return nil }, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
func Configuration ¶
func Configuration(config *Config, configurator configurator.Configurator) *Config
type ReConfiguration ¶
type ReConfiguration struct {
// contains filtered or unexported fields
}
func NewReConfiguration ¶
func NewReConfigurationWithConfigurator ¶
func NewReConfigurationWithConfigurator(quota quota.Quota, logger logger.Logger, config *Config, configurator configurator.Configurator) *ReConfiguration
func (*ReConfiguration) ReConfiguration ¶
func (reConfiguration *ReConfiguration) ReConfiguration(configurator configurator.Configurator) error
func (*ReConfiguration) Serve ¶
func (reConfiguration *ReConfiguration) Serve(ctx context.Context)
func (*ReConfiguration) State ¶
func (reConfiguration *ReConfiguration) State() State
func (*ReConfiguration) Stater ¶
func (reConfiguration *ReConfiguration) Stater() Stater
type Stater ¶
func NewWithConfigurator ¶
func NewWithConfigurator( config *Config, configurator configurator.Configurator, logger logger.Logger, quota quota.Quota, ) (Stater, error)
Click to show internal directories.
Click to hide internal directories.