Documentation ¶
Index ¶
- Constants
- Variables
- func Decoder(target interface{}, allowUnused bool) (*mapstructure.Decoder, error)
- func DefaultConfigFile() []byte
- func LoadAndSanitizeConfig(configData []byte) (string, error)
- func MapStructureDecodeHookFunc() mapstructure.DecodeHookFuncType
- type AuthConfig
- type BaseExporter
- type BasicAuthConfig
- type Bytes
- type Config
- type ExecCachingExporterConfig
- type ExecExporterConfig
- type Exporter
- type ExporterDefaults
- type ExportersConfig
- type FileExporterConfig
- type HTTPExporterConfig
- type HTTPStatusRange
- type HTTPVerb
- type IPNetwork
- type MapStructureDecoder
- type ProxyURL
- type Regexp
- type ReverseExporterConfig
- type TLSCertificatePool
- type URL
- type WebConfig
Constants ¶
const ( TLSCACertsSystem string = "system" ProxyEnvironment string = "environment" ProxyDirect string = "direct" )
const (
TLSCertificatePoolMaxNonFileEntryReturn int = 50
)
Variables ¶
var ( ErrInvalidExportersConfig = errors.New("exporters key is not in the known format") ErrUnknownExporterType = errors.New("unknown exporter type specified") )
var ( ErrInvalidInputType = errors.New("invalid input type for decoder") ErrInvalidPEMFile = errors.New("PEM file could not be added to certificate pool") )
var (
ErrMapStructureDecode = errors.New("MapStructureDecode function failed")
)
Functions ¶
func Decoder ¶
func Decoder(target interface{}, allowUnused bool) (*mapstructure.Decoder, error)
Decoder returns the decoder for config maps.
func DefaultConfigFile ¶
func DefaultConfigFile() []byte
DefaultConfigFile returns the default embedded YAML config which sets the poller_defaults.
func LoadAndSanitizeConfig ¶
LoadAndSanitizeConfig is used purely for displaying the config to users. It removes sensitive keys from the config and provides a reserialized YAML view of it.
func MapStructureDecodeHookFunc ¶
func MapStructureDecodeHookFunc() mapstructure.DecodeHookFuncType
MapStructureDecodeHookFunc returns a DecodeHookFunc that applies output to the UnmarshalYAML function, when the target type implements the yaml.Unmarshaller interface.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
BasicAuthCredentials []BasicAuthConfig `mapstructure:"basic_auth,omitempty"`
}
AuthConfig holds the configuration of any authentication put on the exporter interface.
type BaseExporter ¶
type BaseExporter interface {
GetBaseExporter() Exporter
}
BaseExporter is the interface all exporters must implement.
type BasicAuthConfig ¶
type BasicAuthConfig struct { Username string `mapstructure:"username,omitempty"` // Username to accept Password string `mapstructure:"password,omitempty"` // Plain text password to accept }
BasicAuthConfig defines basic authentication credentials to accept on the web interface. If Password is not set, then the credential set is ignored. The password is plaintext.
type Bytes ¶
type Bytes []byte
Bytes implements a custom []byte slice implemented TextMarshaller so base64 binary content can be passed n.
func (*Bytes) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Bytes) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Config ¶
type Config struct { Web *WebConfig `mapstructure:"web,omitempty"` ExporterDefaults *ExporterDefaults `mapstructure:"exporter_defaults,omitempty"` ReverseExporters []*ReverseExporterConfig `mapstructure:"reverse_exporters,omitempty"` }
Config is the main application configuration structure.
func LoadFromFile ¶
type ExecCachingExporterConfig ¶
type ExecCachingExporterConfig struct { Exporter `mapstructure:",squash"` Command string `mapstructure:"command"` Args []string `mapstructure:"args"` ExecInterval model.Duration `mapstructure:"exec_interval"` }
ExecCachingExporterConfig contains configuration specific to reverse proxying cached executable scripts.
type ExecExporterConfig ¶
type ExecExporterConfig struct { Exporter `mapstructure:",squash"` Command string `mapstructure:"command"` Args []string `mapstructure:"args"` }
ExecExporterConfig contains configuration specific to reverse proxying executable scripts.
type Exporter ¶
type Exporter struct { // Name is the name of the underlying exporter which will be appended to the metrics Name string `mapstructure:"name"` // NoRewrite disables appending of the name (explicit labels will be appended however) NoRewrite bool `mapstructure:"no_rewrite"` // Labels are additional key-value labels which should be statically added to all metrics Labels map[string]string `mapstructure:"labels"` }
Exporter implements BaseExporter.
func (Exporter) GetBaseExporter ¶
GetBaseExporter returns the common exporter parameters of an exporter.
type ExporterDefaults ¶
type ExporterDefaults struct { HTTPDefaults *HTTPExporterConfig `mapstructure:"http"` FileDefaults *FileExporterConfig `mapstructure:"file"` ExecDefaults *ExecExporterConfig `mapstructure:"exec"` ExecCachedDefaults *ExecCachingExporterConfig `mapstructure:"exec_cached"` }
type ExportersConfig ¶
type ExportersConfig struct { HTTPExporters []*HTTPExporterConfig `mapstructure:"http"` FileExporters []*FileExporterConfig `mapstructure:"file"` ExecExporters []*ExecExporterConfig `mapstructure:"exec"` ExecCachedExporters []*ExecCachingExporterConfig `mapstructure:"exec_cached"` }
ExportersConfig is the internal mapping the exporter config representation.
func (*ExportersConfig) All ¶
func (ex *ExportersConfig) All() []BaseExporter
type FileExporterConfig ¶
type FileExporterConfig struct { Exporter `mapstructure:",squash"` Path string `mapstructure:"path"` }
FileExporterConfig contains configuration specific to reverse proxying files.
type HTTPExporterConfig ¶
type HTTPExporterConfig struct { Exporter `mapstructure:",squash"` // A URI giving the address the exporter is found at. // HTTP: http://localhost/metrics // Unix: http://unix:/path/to/socket:/metrics Address string `mapstructure:"address"` // Timeout is the maximum length of time connecting to and retrieving the // results of this exporter can take. Timeout model.Duration `mapstructure:"timeout,omitempty"` // ForwardURLParams determines whether the exporter will have ALL url params // of the parent request added to it. ForwardURLParams bool `mapstructure:"forward_url_params"` }
HTTPExporterConfig contains configuration specific to reverse proxying normal http-based Prometheus exporters.
type HTTPStatusRange ¶
HTTPStatusRange is a range of HTTP status codes which can be specifid in YAML using human-friendly ranging notation.
func (*HTTPStatusRange) FromString ¶
func (hsr *HTTPStatusRange) FromString(ranges string) error
FromString initializes a new HTTPStatusRange from the given string specifier
func (HTTPStatusRange) MarshalText ¶
func (hsr HTTPStatusRange) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler.
func (*HTTPStatusRange) UnmarshalText ¶
func (hsr *HTTPStatusRange) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler.
type HTTPVerb ¶
type HTTPVerb string
HTTPVerb wraps string to ensure that verbs are uppercase. It doesn't check if they're valid to allow people to do stupid things with them if they want.
func (*HTTPVerb) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*HTTPVerb) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type IPNetwork ¶
IPNetwork is the config wrapper type for an IP Network.
func (IPNetwork) MarshalYAML ¶
func (*IPNetwork) UnmarshalYAML ¶
type MapStructureDecoder ¶
type MapStructureDecoder interface {
MapStructureDecode(interface{}) error
}
MapStructureDecoder is detected by MapStructureDecodeHookFunc to allow a type to decode itself.
type ProxyURL ¶
type ProxyURL string
ProxyURL is a custom type to validate roxy specifications.
func (*ProxyURL) MarshalText ¶
UnmarshalText MarshalText encoding.UnmarshalText.
func (*ProxyURL) UnmarshalText ¶
UnmarshalText implements encoding.UnmarshalText.
type Regexp ¶
Regexp encapsulates a regexp.Regexp and makes it YAML marshallable.
func (*Regexp) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Regexp) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type ReverseExporterConfig ¶
type ReverseExporterConfig struct { // Path is the URL path this set of exporters will be found under. Path string `mapstructure:"path"` // Auth is the auth to request for this path Auth *AuthConfig `mapstructure:"auth,omitempty"` // Exporters is a list of URLs defining exporter endpoints to be aggregated // and the unique name to be given to differentiate their metrics. Exporters *ExportersConfig `mapstructure:"exporters"` }
ReverseExporterConfig is a configuration struct describing a logically-decoded proxied exporter.
type TLSCertificatePool ¶
TLSCertificatePool is our custom type for decoding a certificate pool out of YAML.
func (*TLSCertificatePool) MapStructureDecode ¶
func (t *TLSCertificatePool) MapStructureDecode(input interface{}) error
MapStructureDecode implements the yaml.Unmarshaler interface for tls_cacerts.
type URL ¶
URL is a custom URL type that allows validation at configuration load time.
func (*URL) MarshalText ¶
MarshalYAML implements the yaml.Marshaler interface for URLs.
func (*URL) UnmarshalText ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for URLs.