config

package
v0.0.0-...-355f5ee Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultScrapeConfig = ScrapeConfig{
		ScrapeInterval: model.Duration(time.Minute),
		ScrapeTimeout:  model.Duration(time.Minute),
		Scheme:         "http",
		ProfilingConfig: &ProfilingConfig{
			PprofConfig: &PprofConfig{
				Allocs: &PprofAllocsConfig{
					PprofProfilingConfig{
						Enabled: &trueValue,
						Path:    "/debug/pprof/allocs",
					},
				},
				Block: &PprofBlockConfig{
					PprofProfilingConfig{
						Enabled: &trueValue,
						Path:    "/debug/pprof/block",
					},
				},
				Cmdline: &PprofCmdlineConfig{
					PprofProfilingConfig{
						Enabled: &trueValue,
						Path:    "/debug/pprof/cmdline",
					},
				},
				Goroutine: &PprofGoroutineConfig{
					PprofProfilingConfig{
						Enabled: &trueValue,
						Path:    "/debug/pprof/goroutine",
					},
				},
				Heap: &PprofHeapConfig{
					PprofProfilingConfig{
						Enabled: &trueValue,
						Path:    "/debug/pprof/heap",
					},
				},
				Mutex: &PprofMutexConfig{
					PprofProfilingConfig{
						Enabled: &trueValue,
						Path:    "/debug/pprof/mutex",
					},
				},
				Profile: &PprofProfileConfig{
					PprofProfilingConfig{
						Enabled: &trueValue,
						Path:    "/debug/pprof/profile",
					},
				},
				Threadcreate: &PprofThreadcreateConfig{
					PprofProfilingConfig{
						Enabled: &trueValue,
						Path:    "/debug/pprof/threadcreate",
					},
				},
				Trace: &PprofTraceConfig{
					PprofProfilingConfig{
						Enabled: &trueValue,
						Path:    "/debug/pprof/trace",
					},
				},
			},
		},
	}
)

Functions

func CheckTargetAddress

func CheckTargetAddress(address model.LabelValue) error

CheckTargetAddress checks if target address is valid.

func NewBasicAuthRoundTripper

func NewBasicAuthRoundTripper(username string, password Secret, passwordFile string, rt http.RoundTripper) http.RoundTripper

NewBasicAuthRoundTripper will apply a BASIC auth authorization header to a request unless it has already been set.

func NewBearerAuthFileRoundTripper

func NewBearerAuthFileRoundTripper(bearerFile string, rt http.RoundTripper) http.RoundTripper

NewBearerAuthFileRoundTripper adds the bearer token read from the provided file to a request unless the authorization header has already been set. This file is read for every request.

func NewBearerAuthRoundTripper

func NewBearerAuthRoundTripper(token Secret, rt http.RoundTripper) http.RoundTripper

NewBearerAuthRoundTripper adds the provided bearer token to a request unless the authorization header has already been set.

func NewClientFromConfig

func NewClientFromConfig(cfg HTTPClientConfig, name string) (*http.Client, error)

NewClientFromConfig returns a new HTTP client configured for the given config.HTTPClientConfig. The name is used as go-conntrack metric label.

func NewRoundTripperFromConfig

func NewRoundTripperFromConfig(cfg HTTPClientConfig, name string) (http.RoundTripper, error)

NewRoundTripperFromConfig returns a new HTTP RoundTripper configured for the given config.HTTPClientConfig. The name is used as go-conntrack metric label.

func NewTLSConfig

func NewTLSConfig(cfg *TLSConfig) (*tls.Config, error)

NewTLSConfig creates a new tls.Config from the given TLSConfig.

Types

type BasicAuth

type BasicAuth struct {
	Username     string `yaml:"username"`
	Password     Secret `yaml:"password,omitempty"`
	PasswordFile string `yaml:"password_file,omitempty"`
}

BasicAuth contains basic HTTP authentication credentials.

func (*BasicAuth) UnmarshalYAML

func (a *BasicAuth) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Config

type Config struct {
	ScrapeConfigs []*ScrapeConfig `yaml:"scrape_configs,omitempty"`
	// contains filtered or unexported fields
}

Config is the top-level configuration for conprof's config files.

func Load

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

Load parses the YAML input s into a Config.

func LoadFile

func LoadFile(filename string) (*Config, error)

LoadFile parses the given YAML file into a Config.

type HTTPClientConfig

type HTTPClientConfig struct {
	// The HTTP basic authentication credentials for the targets.
	BasicAuth *BasicAuth `yaml:"basic_auth,omitempty"`
	// The bearer token for the targets.
	BearerToken Secret `yaml:"bearer_token,omitempty"`
	// The bearer token file for the targets.
	BearerTokenFile string `yaml:"bearer_token_file,omitempty"`
	// HTTP proxy server to use to connect to the targets.
	ProxyURL URL `yaml:"proxy_url,omitempty"`
	// TLSConfig to use to connect to the targets.
	TLSConfig TLSConfig `yaml:"tls_config,omitempty"`
}

HTTPClientConfig configures an HTTP client.

func (HTTPClientConfig) String

func (c HTTPClientConfig) String() string

func (*HTTPClientConfig) UnmarshalYAML

func (c *HTTPClientConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface

func (*HTTPClientConfig) Validate

func (c *HTTPClientConfig) Validate() error

Validate validates the HTTPClientConfig to check only one of BearerToken, BasicAuth and BearerTokenFile is configured.

type PprofAllocsConfig

type PprofAllocsConfig struct {
	PprofProfilingConfig `yaml:",inline"`
}

type PprofBlockConfig

type PprofBlockConfig struct {
	PprofProfilingConfig `yaml:",inline"`
}

type PprofCmdlineConfig

type PprofCmdlineConfig struct {
	PprofProfilingConfig `yaml:",inline"`
}

type PprofConfig

type PprofConfig struct {
	Allocs       *PprofAllocsConfig       `yaml:"allocs,omitempty"`
	Block        *PprofBlockConfig        `yaml:"block,omitempty"`
	Cmdline      *PprofCmdlineConfig      `yaml:"cmdline,omitempty"`
	Goroutine    *PprofGoroutineConfig    `yaml:"goroutine,omitempty"`
	Heap         *PprofHeapConfig         `yaml:"heap,omitempty"`
	Mutex        *PprofMutexConfig        `yaml:"mutex,omitempty"`
	Profile      *PprofProfileConfig      `yaml:"profile,omitempty"`
	Threadcreate *PprofThreadcreateConfig `yaml:"threadcreate,omitempty"`
	Trace        *PprofTraceConfig        `yaml:"trace,omitempty"`
}

type PprofGoroutineConfig

type PprofGoroutineConfig struct {
	PprofProfilingConfig `yaml:",inline"`
}

type PprofHeapConfig

type PprofHeapConfig struct {
	PprofProfilingConfig `yaml:",inline"`
}

type PprofMutexConfig

type PprofMutexConfig struct {
	PprofProfilingConfig `yaml:",inline"`
}

type PprofProfileConfig

type PprofProfileConfig struct {
	PprofProfilingConfig `yaml:",inline"`
}

type PprofProfilingConfig

type PprofProfilingConfig struct {
	Enabled *bool  `yaml:"enabled,omitempty"`
	Path    string `yaml:"path,omitempty"`
}

type PprofThreadcreateConfig

type PprofThreadcreateConfig struct {
	PprofProfilingConfig `yaml:",inline"`
}

type PprofTraceConfig

type PprofTraceConfig struct {
	PprofProfilingConfig `yaml:",inline"`
}

type ProfilingConfig

type ProfilingConfig struct {
	PprofConfig *PprofConfig `yaml:"pprof_config,omitempty"`
}

type ScrapeConfig

type ScrapeConfig struct {
	// Name of the section in the config
	JobName string `yaml:"job_name,omitempty"`
	// A set of query parameters with which the target is scraped.
	Params url.Values `yaml:"params,omitempty"`
	// How frequently to scrape the targets of this scrape config.
	ScrapeInterval model.Duration `yaml:"scrape_interval,omitempty"`
	// The timeout for scraping targets of this config.
	ScrapeTimeout model.Duration `yaml:"scrape_timeout,omitempty"`
	// The URL scheme with which to fetch metrics from targets.
	Scheme string `yaml:"scheme,omitempty"`

	ProfilingConfig *ProfilingConfig `yaml:"profiling_config,omitempty"`

	// We cannot do proper Go type embedding below as the parser will then parse
	// values arbitrarily into the overflow maps of further-down types.
	ServiceDiscoveryConfig ServiceDiscoveryConfig `yaml:",inline"`
	HTTPClientConfig       HTTPClientConfig       `yaml:",inline"`
}

ScrapeConfig configures a scraping unit for conprof.

func (*ScrapeConfig) UnmarshalYAML

func (c *ScrapeConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type Secret

type Secret string

Secret special type for storing secrets.

func (Secret) MarshalYAML

func (s Secret) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface for Secrets.

func (*Secret) UnmarshalYAML

func (s *Secret) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface for Secrets.

type ServiceDiscoveryConfig

type ServiceDiscoveryConfig struct {
	// List of labeled target groups for this job.
	StaticConfigs []*targetgroup.Group `yaml:"static_configs,omitempty"`
}

ServiceDiscoveryConfig configures lists of different service discovery mechanisms.

type TLSConfig

type TLSConfig struct {
	// The CA cert to use for the targets.
	CAFile string `yaml:"ca_file,omitempty"`
	// The client cert file for the targets.
	CertFile string `yaml:"cert_file,omitempty"`
	// The client key file for the targets.
	KeyFile string `yaml:"key_file,omitempty"`
	// Used to verify the hostname for the targets.
	ServerName string `yaml:"server_name,omitempty"`
	// Disable target certificate validation.
	InsecureSkipVerify bool `yaml:"insecure_skip_verify"`
}

TLSConfig configures the options for TLS connections.

func (*TLSConfig) UnmarshalYAML

func (c *TLSConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type URL

type URL struct {
	*url.URL
}

URL is a custom URL type that allows validation at configuration load time.

func (URL) MarshalYAML

func (u URL) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface for URLs.

func (*URL) UnmarshalYAML

func (u *URL) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface for URLs.

Jump to

Keyboard shortcuts

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