forwarder

package
v0.0.0-...-18e1ab8 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 21 Imported by: 1

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
	ToAuthorize   *url.URL
	ToUpload      *url.URL
	FromToken     string
	ToToken       string
	FromTokenFile string
	ToTokenFile   string
	FromCAFile    string
	TLSCertFile   string
	TLSKey        string

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

	Logger log.Logger
	Tracer trace.TracerProvider
}

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