config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidExportersConfig = errors.New("exporters key is not in the known format")
	ErrUnknownExporterType    = errors.New("unknown exporter type specified")
)

nolint: golint

View Source
var (
	// DefaultNetTimeout is the default timeout set for remote network exporters.
	DefaultNetTimeout = model.Duration(time.Second * 1)
)

Functions

func Save

func Save(cfg *ExporterConfig) ([]byte, error)

Save dumps an ExporterConfig as a YAML file.

Types

type AuthType

type AuthType string

AuthType is one of several constants used to specify the type of authentication a reverse proxy endpoint should have. The default empty string means no auth.

const (
	AuthTypeNone  AuthType = ""      // no authentication
	AuthTypeBasic AuthType = "basic" // basic authentication
)

nolint: golint

type BaseExporter

type BaseExporter interface {
	GetBaseExporter() Exporter
}

BaseExporter is the interface all exporters must implement

type ExecCachingExporterConfig

type ExecCachingExporterConfig struct {
	Command      string         `yaml:"command"`
	Args         []string       `yaml:"args"`
	ExecInterval model.Duration `yaml:"exec_interval"`
	Exporter     `yaml:",inline"`
}

ExecCachingExporterConfig contains configuration specific to reverse proxying cached executable scripts

func (*ExecCachingExporterConfig) UnmarshalYAML

func (ecec *ExecCachingExporterConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaller

type ExecExporterConfig

type ExecExporterConfig struct {
	Command  string   `yaml:"command"`
	Args     []string `yaml:"args"`
	Exporter `yaml:",inline"`
}

ExecExporterConfig contains configuration specific to reverse proxying executable scripts

func (*ExecExporterConfig) UnmarshalYAML

func (eec *ExecExporterConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaller

type Exporter

type Exporter struct {
	// Name is the name of the underlying exporter which will be appended to the metrics
	Name string `yaml:"name"`
	// NoRewrite disables appending of the name (explicit labels will be appended however)
	NoRewrite bool `yaml:"no_rewrite"`
	// Labels are additional key-value labels which should be statically added to all metrics
	Labels map[string]string `yaml:"labels"`
}

Exporter implements BaseExporter

func (Exporter) GetBaseExporter

func (e Exporter) GetBaseExporter() Exporter

GetBaseExporter returns the common exporter parameters of an exporter TODO: make correctly read-only

type ExporterConfig

type ExporterConfig struct {
	ReverseExporters []ReverseExporter `yaml:"reverse_exporters"`
	// Catch-all to error on invalid config
	XXX map[string]interface{} `yaml:",inline,omitempty"`
}

ExporterConfig is the global configuration.

func Load

func Load(s string) (*ExporterConfig, error)

Load parses the given string as a YAML ExporterConfig

func LoadFromFile

func LoadFromFile(filename string) (*ExporterConfig, error)

LoadFromFile loads an ExporterConfig from the given filepath

type FileExporterConfig

type FileExporterConfig struct {
	Path     string `yaml:"path"`
	Exporter `yaml:",inline"`
}

FileExporterConfig contains configuration specific to reverse proxying files

func (*FileExporterConfig) UnmarshalYAML

func (fec *FileExporterConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaller

type HTTPExporterConfig

type HTTPExporterConfig struct {
	// A URI giving the address the exporter is found at.
	// HTTP: http://localhost/metrics
	// Unix: http://unix:/path/to/socket:/metrics
	Address string `yaml:"address"`
	// Timeout is the maximum length of time connecting to and retrieving the
	// results of this exporter can take.
	Timeout model.Duration `yaml:"timeout,omitempty"`
	// ForwardURLParams determines whether the exporter will have ALL url params
	// of the parent request added to it.
	ForwardURLParams bool `yaml:"forward_url_params"`
	Exporter         `yaml:",inline"`
}

HTTPExporterConfig contains configuration specific to reverse proxying normal http-based Prometheus exporters

func (*HTTPExporterConfig) UnmarshalYAML

func (hec *HTTPExporterConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaller

type ReverseExporter

type ReverseExporter struct {
	// Path is the URL path this set of exporters will be found under.
	Path string `yaml:"path"`
	// Exporters is a list of URLs defining exporter endpoints to be aggregated
	// and the unique name to be given to differentiate their metrics.
	Exporters []interface{} `yaml:"exporters"`
	// AuthType is the type of authentication backend to use for this reverse
	// proxy. Currently only nothing and "basic" are supported.
	AuthType AuthType `yaml:"auth_type"`
	// HtPasswdFile is the HtPasswd file to use for basic auth if basic auth is
	// requested.
	HtPasswdFile string `yaml:"htpasswd_file"`
}

ReverseExporter is a configuration struct describing a logically-decoded proxied exporter

func (*ReverseExporter) UnmarshalYAML

func (re *ReverseExporter) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaller

Jump to

Keyboard shortcuts

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