prometheus

package
v0.0.0-...-b274fa0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PortNames = struct {
	HTTP string
}{
	"http",
}

Functions

func HealthCheck

func HealthCheck(ctx context.Context, promAddr string) error

Types

type Action

type Action string
const (
	// Replace performs a regex replacement.
	Replace Action = "replace"
	// Keep drops targets for which the input does not match the regex.
	Keep Action = "keep"
	// Drop drops targets for which the input does match the regex.
	Drop Action = "drop"
	// HashMod sets a label to the modulus of a hash of labels.
	HashMod Action = "hashmod"
	// LabelMap copies labels to other labelnames based on a regex.
	LabelMap Action = "labelmap"
	// LabelDrop drops any label matching the regex.
	LabelDrop Action = "labeldrop"
	// LabelKeep drops any label not matching the regex.
	LabelKeep Action = "labelkeep"
)

type Config

type Config struct {
	Common runner.Config
	Jobs   map[string]ScrapeConfig
}

Config describes how to run a single Prometheus instance.

func NewConfig

func NewConfig(jobs map[string]ScrapeConfig, tls *pki.TLSConfigPEM) Config

func (Config) Args

func (cc Config) Args() []string

func (Config) Config

func (cc Config) Config() runner.Config

func (Config) Env

func (cc Config) Env() []string

func (Config) Files

func (cc Config) Files() map[string]string

func (Config) Name

func (cc Config) Name() string

func (Config) WithConfig

func (cc Config) WithConfig(cfg runner.Config) runner.Command

type ConsulServiceDiscoveryConfig

type ConsulServiceDiscoveryConfig struct {
	Server   string
	Services []string
}

type FileServiceDiscoveryConfig

type FileServiceDiscoveryConfig struct {
	FilePatterns    []string       `yaml:"files"`
	RefreshInterval *time.Duration `yaml:"refresh_interval,omitempty"`
}

type GlobalConfig

type GlobalConfig struct {
	ScrapeInterval time.Duration `yaml:"scrape_interval,omitempty"`
}

type Ports

type Ports struct {
	HTTP int
}

func DefPorts

func DefPorts() Ports

func (Ports) RunnerPorts

func (c Ports) RunnerPorts() yurt.Ports

type PrometheusConfig

type PrometheusConfig struct {
	Global        *GlobalConfig  `yaml:"global,omitempty"`
	ScrapeConfigs []ScrapeConfig `yaml:"scrape_configs"`
}

type RelabelConfig

type RelabelConfig struct {
	// A list of labels from which values are taken and concatenated
	// with the configured separator in order.
	SourceLabels model.LabelNames `yaml:"source_labels,flow,omitempty"`
	// Separator is the string between concatenated values from the source labels.
	Separator string `yaml:"separator,omitempty"`
	// Regex against which the concatenation is matched.
	Regex string `yaml:"regex,omitempty"`
	// Modulus to take of the hash of concatenated values from the source labels.
	Modulus uint64 `yaml:"modulus,omitempty"`
	// TargetLabel is the label to which the resulting string is written in a replacement.
	// Regexp interpolation is allowed for the replace action.
	TargetLabel string `yaml:"target_label,omitempty"`
	// Replacement is the regex replacement pattern to be used.
	Replacement string `yaml:"replacement,omitempty"`
	// Action is the action to be performed for the relabeling.
	Action Action `yaml:"action,omitempty"`
}

type ScrapeConfig

type ScrapeConfig struct {
	JobName string `yaml:"job_name"`
	// Indicator whether the scraped metrics should remain unmodified.
	HonorLabels bool `yaml:"honor_labels,omitempty"`
	// Indicator whether the scraped timestamps should be respected.
	HonorTimestamps bool `yaml:"honor_timestamps,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 time.Duration `yaml:"scrape_interval,omitempty"`
	// The timeout for scraping targets of this config.
	ScrapeTimeout time.Duration `yaml:"scrape_timeout,omitempty"`
	// The HTTP resource path on which to fetch metrics from targets.
	MetricsPath string `yaml:"metrics_path,omitempty"`
	// The URL scheme with which to fetch metrics from targets.
	Scheme string `yaml:"scheme,omitempty"`
	// More than this many samples post metric-relabeling will cause the scrape to fail.
	SampleLimit uint `yaml:"sample_limit,omitempty"`
	// More than this many targets after the target relabeling will cause the
	// scrapes to fail.
	TargetLimit uint `yaml:"target_limit,omitempty"`

	ConsulServiceDiscoveryConfigs []ConsulServiceDiscoveryConfig `yaml:"consul_sd_configs,omitempty"`
	FileServiceDiscoveryConfigs   []FileServiceDiscoveryConfig   `yaml:"file_sd_configs,omitempty"`

	HTTPClientConfig config.HTTPClientConfig `yaml:",inline"`

	// List of target relabel configurations.
	RelabelConfigs []RelabelConfig `yaml:"relabel_configs,omitempty"`
	// List of metric relabel configurations.
	MetricRelabelConfigs []RelabelConfig `yaml:"metric_relabel_configs,omitempty"`
}

Jump to

Keyboard shortcuts

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