forwarder

package
v0.0.0-...-a761d13 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	From          *url.URL
	ToUpload      *url.URL
	FromToken     string
	FromTokenFile string
	FromCAFile    string

	AnonymizeLabels   []string
	AnonymizeSalt     string
	AnonymizeSaltFile string
	Debug             bool
	Interval          time.Duration
	LimitBytes        int64
	Rules             []string
	RecordingRules    []string
	RulesFile         string
	Transformer       metricfamily.Transformer

	Logger                  log.Logger
	SimulatedTimeseriesFile string
}

Config defines the parameters that can be used to configure a worker. The only required field is `From`.

type RuleMatcher

type RuleMatcher interface {
	MatchRules() []string
}

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Worker represents a metrics forwarding agent. It collects metrics from a source URL and forwards them to a sink. A Worker should be configured with a `Config` and instantiated with the `New` func. Workers are thread safe; all access to shared fields are synchronized.

func New

func New(cfg Config) (*Worker, error)

New creates a new Worker based on the provided Config. If the Config contains invalid values, then an error is returned.

func (*Worker) LastMetrics

func (w *Worker) LastMetrics() []*clientmodel.MetricFamily

func (*Worker) Reconfigure

func (w *Worker) Reconfigure(cfg Config) error

Reconfigure temporarily stops a worker and reconfigures is with the provided Config. Is thread safe and can run concurrently with `LastMetrics` and `Run`.

func (*Worker) Run

func (w *Worker) Run(ctx context.Context)

Jump to

Keyboard shortcuts

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