config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(cfg HTTPClient) (*http.Client, error)

Types

type Config

type Config struct {
	Database         Database           `yaml:"database"`
	MetricCollector  MetricCollector    `yaml:"metric_collector,omitempty"`
	RulesCollectors  []*RulesCollector  `yaml:"rules_collectors,omitempty"`
	LabelsCollectors []*LabelsCollector `yaml:"labels_collectors,omitempty"`
	PersesCollector  PersesCollector    `yaml:"perses_collector,omitempty"`
	GrafanaCollector GrafanaCollector   `yaml:"grafana_collector,omitempty"`
}

func Resolve

func Resolve(configFile string) (Config, error)

type Database added in v0.3.0

type Database struct {
	// Define if the database is stored in a file or in memory
	InMemory *bool `yaml:"in_memory,omitempty"`
	// In case the database is stored in a file, then the path to a JSON file must be defined
	Path string `yaml:"path,omitempty"`
	// FlushPeriod defines the frequency the system will flush the data into the JSON file
	FlushPeriod model.Duration `yaml:"flush_period,omitempty"`
}

func (*Database) Verify added in v0.3.0

func (d *Database) Verify() error

type GrafanaCollector

type GrafanaCollector struct {
	Enable            bool           `yaml:"enable"`
	Period            model.Duration `yaml:"period,omitempty"`
	MetricUsageClient *HTTPClient    `yaml:"metric_usage_client,omitempty"`
	HTTPClient        HTTPClient     `yaml:"grafana_client"`
}

func (*GrafanaCollector) Verify

func (c *GrafanaCollector) Verify() error

type HTTPClient

type HTTPClient struct {
	URL           *common.URL           `yaml:"url"`
	OAuth         *config.OAuth         `yaml:"oauth,omitempty"`
	BasicAuth     *secret.BasicAuth     `yaml:"basic_auth,omitempty"`
	Authorization *secret.Authorization `yaml:"authorization,omitempty"`
	TLSConfig     *secret.TLSConfig     `yaml:"tls_config,omitempty"`
}

type LabelsCollector added in v0.4.0

type LabelsCollector struct {
	Enable bool           `yaml:"enable"`
	Period model.Duration `yaml:"period,omitempty"`
	// MetricUsageClient is a client to send the metrics usage to a remote metrics_usage server.
	MetricUsageClient *HTTPClient `yaml:"metric_usage_client,omitempty"`
	HTTPClient        HTTPClient  `yaml:"prometheus_client"`
}

func (*LabelsCollector) Verify added in v0.4.0

func (c *LabelsCollector) Verify() error

type MetricCollector

type MetricCollector struct {
	Enable     bool           `yaml:"enable"`
	Period     model.Duration `yaml:"period,omitempty"`
	HTTPClient HTTPClient     `yaml:"http_client"`
}

func (*MetricCollector) Verify

func (c *MetricCollector) Verify() error

type PersesCollector

type PersesCollector struct {
	Enable            bool                    `yaml:"enable"`
	Period            model.Duration          `yaml:"period,omitempty"`
	MetricUsageClient *HTTPClient             `yaml:"metric_usage_client,omitempty"`
	HTTPClient        config.RestConfigClient `yaml:"perses_client"`
}

func (*PersesCollector) Verify

func (c *PersesCollector) Verify() error

type RulesCollector

type RulesCollector struct {
	Enable bool           `yaml:"enable"`
	Period model.Duration `yaml:"period,omitempty"`
	// MetricUsageClient is a client to send the metrics usage to a remote metrics_usage server.
	MetricUsageClient *HTTPClient `yaml:"metric_usage_client,omitempty"`
	// RetryToGetRules is the number of retries the collector will do to get the rules from Prometheus before actually failing.
	// Between each retry, the collector will wait first 10 seconds, then 20 seconds, then 30 seconds ...etc.
	RetryToGetRules uint       `yaml:"retry_to_get_rules,omitempty"`
	HTTPClient      HTTPClient `yaml:"prometheus_client"`
}

func (*RulesCollector) Verify

func (c *RulesCollector) Verify() error

Jump to

Keyboard shortcuts

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