config

package
v3.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExporterConfig

type ExporterConfig struct {
	// LogLevel is the log level.
	LogLevel string `yaml:"log_level"`

	// HTTPServerConfig is the configuration for the HTTP server.
	HTTPServerConfig struct {
		ListenAddress string `yaml:"listen_address"`
		MetricsPath   string `yaml:"metrics_path"`
	} `yaml:"http_server"`

	// SamplesPath is the path to the samples.
	SamplesPath string `yaml:"samples_path"`

	// SchedulerConfig is the configuration for the scheduler.
	SchedulerConfig struct {
		// RefreshSamplesInterval is the interval to refresh the samples.
		RefreshSamplesInterval time.Duration `yaml:"refresh_samples_interval"`
		// EnqueueSamplesInterval is the interval to enqueue the samples.
		EnqueueSamplesInterval time.Duration `yaml:"enqueue_samples_interval"`
		// GCInterval is the interval to run the garbage collector.
		GCInterval time.Duration `yaml:"gc_interval"`
	} `yaml:"scheduler"`

	BasicAuth struct {
		Enabled  bool          `yaml:"enabled" default:"false"`
		Username StringFromEnv `yaml:"username"`
		Password StringFromEnv `yaml:"password"`
	} `yaml:"basic_auth"`

	WorkerConfig struct {
		// ParallelJobs is the size of the channel.
		ParallelJobs int `yaml:"parallel_jobs"`
		// MaxQueueSize is the max size of the queue.
		MaxQueueSize int `yaml:"max_queue_size"`
		// SleepBetweenJobs is the sleep between jobs.
		SleepBetweenJobs time.Duration `yaml:"sleep_between_jobs"`
		// DisableBGTasks is the flag to disable the background tasks.
		DisableBGTasks bool `yaml:"disable_bg_tasks"`
	} `yaml:"worker"`

	// ReportConfig is the configuration for the report.
	ReportConfig struct {
		// Enabled is the flag to enable the report.
		Enabled bool `yaml:"enabled"`
		// S3Config is the configuration for the S3.
		S3Config struct {
			// Enabled is the flag to enable the S3.
			Enabled bool `yaml:"enabled"`
			// Bucket is the bucket name.
			Bucket string `yaml:"bucket"`
			// Region is the region.
			Region string `yaml:"region"`
			// AccessKeyID is the access key ID.
			AccessKeyID string `yaml:"access_key_id"`
			// SecretAccessKey is the secret access key.
			SecretAccessKey string `yaml:"secret_access_key"`
			// Endpoint is the endpoint.
			Endpoint string `yaml:"endpoint"`
			// ForcePathStyle is the flag to force path style.
			ForcePathStyle bool `yaml:"force_path_style"`
			// UseSSL is the flag to use SSL.
			UseSSL bool `yaml:"use_ssl"`
		} `yaml:"s3"`
		// CallbackConfig is the configuration for the callback.
		CallbackConfig struct {
			// Enabled is the flag to enable the callback.
			Enabled bool `yaml:"enabled"`
			// URL is the URL.
			URL string `yaml:"url"`
		} `yaml:"callback"`
	} `yaml:"report"`

	UsageConfig struct {
		// Enabled is the flag to enable the usage.
		Enabled bool `yaml:"enabled"`
	} `yaml:"usage"`
}

ExporterConfig is the configuration for the exporter.

func LoadExporterConfig

func LoadExporterConfig(data []byte) (*ExporterConfig, error)

LoadExporterConfig loads from byte array.

func LoadExporterConfigFromFile

func LoadExporterConfigFromFile(path string) (*ExporterConfig, error)

LoadExporterConfigFromFile loads from file.

type SampleConfig

type SampleConfig struct {
	// Name is the sample name.
	Name string `yaml:"name,omitempty"`

	// Path is the sample path.
	Path string `yaml:"path,omitempty"`

	// Description is the description of the sample.
	Description string `yaml:"description,omitempty"`

	// Tags is the tags of the sample.
	Tags map[string]string `yaml:"tags,omitempty"`

	// ScrapeInterval is the interval to scrape the sample.
	Interval time.Duration `yaml:"interval,omitempty"`

	// Timeout is the timeout to scrape the sample.
	Timeout time.Duration `yaml:"timeout,omitempty"`

	// Retry is the retry to scrape the sample.
	Retry int `yaml:"retry,omitempty" default:"0"`

	// Steps is the steps to scrape the sample.
	Steps []StepConfig `yaml:"steps,omitempty"`

	// Variables is the variables to scrape the sample
	Variables []map[string]string `yaml:"variables,omitempty"`
}

SampleConfig is the sample configuration.

func LoadSampleConfig

func LoadSampleConfig(data []byte) (*SampleConfig, error)

LoadSampleConfig loads from byte array.

func LoadSampleConfigFromFile

func LoadSampleConfigFromFile(path string) (*SampleConfig, error)

LoadSampleConfigFromFile loads from file.

func (*SampleConfig) Verify

func (c *SampleConfig) Verify() error

Verify verifies the sample configuration.

type StepConfig

type StepConfig struct {
	// Plugin is the plugin to scrape the sample. If not value given, the latest used plugin will be used.
	Plugin string `yaml:"plugin,omitempty"`
	// Action is the action to scrape the sample
	Action string `yaml:"action,omitempty"`
	// Parameters is the parameters to scrape the sample
	Parameters map[string]string `yaml:"parameters,omitempty"`
	// Negate is the negate to scrape the sample
	Negate bool `yaml:"negate,omitempty"`
}

StepConfig is the step configuration.

type StringFromEnv added in v3.3.3

type StringFromEnv string

func (StringFromEnv) String added in v3.3.3

func (e StringFromEnv) String() string

func (*StringFromEnv) UnmarshalYAML added in v3.3.3

func (e *StringFromEnv) UnmarshalYAML(value *yaml.Node) error

Jump to

Keyboard shortcuts

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