Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CollectorConfig ¶
type CollectorConfig struct { Name string `yaml:"collector_name"` // name of this collector MinInterval model.Duration `yaml:"min_interval,omitempty"` // minimum interval between query executions Metrics []*MetricConfig `yaml:"metrics"` // metrics/queries defined by this collector Queries []*QueryConfig `yaml:"queries,omitempty"` // named queries defined by this collector // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
CollectorConfig defines a set of metrics and how they are collected.
func (*CollectorConfig) UnmarshalYAML ¶
func (c *CollectorConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface for CollectorConfig.
type Config ¶
type Config struct { Globals *GlobalConfig `yaml:"global"` CollectorFiles []string `yaml:"collector_files,omitempty"` Targets []*TargetConfig `yaml:"targets,omitempty"` Collectors []*CollectorConfig `yaml:"collectors,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` // contains filtered or unexported fields }
Config is a collection of targets and collectors.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for Config.
type GlobalConfig ¶
type GlobalConfig struct { MinInterval model.Duration `yaml:"min_interval"` // minimum interval between query executions, default is 0 ScrapeTimeout model.Duration `yaml:"scrape_timeout"` // per-scrape timeout, global TimeoutOffset model.Duration `yaml:"scrape_timeout_offset"` // offset to subtract from timeout in seconds MaxConns int `yaml:"max_connections"` // maximum number of open connections to any one target MaxIdleConns int `yaml:"max_idle_connections"` // maximum number of idle connections to any one target // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
GlobalConfig contains globally applicable defaults.
func (*GlobalConfig) UnmarshalYAML ¶
func (g *GlobalConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface for GlobalConfig.
type MetricConfig ¶
type MetricConfig struct { Name string `yaml:"metric_name"` // the Prometheus metric name TypeString string `yaml:"type"` // the Prometheus metric type Help string `yaml:"help"` // the Prometheus metric help text KeyLabels []string `yaml:"key_labels,omitempty"` // expose these columns as labels from SQL StaticLabels map[string]string `yaml:"static_labels,omitempty"` // fixed key/value pairs as static labels ValueLabel string `yaml:"value_label,omitempty"` // with multiple value columns, map their names under this label Values []string `yaml:"values"` // expose each of these columns as a value, keyed by column name QueryLiteral string `yaml:"query,omitempty"` // a literal query QueryRef string `yaml:"query_ref,omitempty"` // references a query in the query map // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` // contains filtered or unexported fields }
MetricConfig defines a Prometheus metric, the SQL query to populate it and the mapping of columns to metric keys/values.
func (*MetricConfig) Query ¶
func (m *MetricConfig) Query() *QueryConfig
Query returns the query defined (as a literal) or referenced by the metric.
func (*MetricConfig) UnmarshalYAML ¶
func (m *MetricConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface for MetricConfig.
func (*MetricConfig) ValueType ¶
func (m *MetricConfig) ValueType() prometheus.ValueType
ValueType returns the metric type, converted to a prometheus.ValueType.
type QueryConfig ¶
type QueryConfig struct { Name string `yaml:"query_name"` // the query name, to be referenced via `query_ref` Query string `yaml:"query"` // the named query // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` // contains filtered or unexported fields }
QueryConfig defines a named query, to be referenced by one or multiple metrics.
func (*QueryConfig) UnmarshalYAML ¶
func (q *QueryConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface for QueryConfig.
type Secret ¶
type Secret string
Secret special type for storing secrets.
func (Secret) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface for Secrets.
func (*Secret) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for Secrets.
type TargetConfig ¶
type TargetConfig struct { Name string `yaml:"name"` // data source name to connect to DSN Secret `yaml:"data_source_name"` // data source definition to connect to Labels map[string]string `yaml:"labels,omitempty"` // labels to apply to all metrics collected from the targets CollectorRefs []string `yaml:"collectors"` // names of collectors to execute on the target TargetsFiles []string `yaml:"targets_files,omitempty"` // slice of path and pattern for files that contains targets // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` // contains filtered or unexported fields }
TargetConfig defines a DSN and a set of collectors to be executed on it.
func (*TargetConfig) Collectors ¶
func (t *TargetConfig) Collectors() []*CollectorConfig
Collectors returns the collectors referenced by the target, resolved.
func (*TargetConfig) UnmarshalYAML ¶
func (t *TargetConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface for TargetConfig.