Documentation ¶
Index ¶
- Variables
- func CheckConfig() error
- func Init(pushData func(at *auth.Token, wr *prompbmarshal.WriteRequest))
- func IsDryRun() bool
- func MetricRelabelDebugSteps(dss []promrelabel.DebugStep, metric, relabelConfigs string, err error) string
- func ServiceDiscoveryResponse(tsr *targetsStatusResult, filter *requestFilter) string
- func Stop()
- func StreamMetricRelabelDebugSteps(qw422016 *qt422016.Writer, dss []promrelabel.DebugStep, ...)
- func StreamServiceDiscoveryResponse(qw422016 *qt422016.Writer, tsr *targetsStatusResult, filter *requestFilter)
- func StreamTargetRelabelDebugSteps(qw422016 *qt422016.Writer, targetID string, dss []promrelabel.DebugStep, ...)
- func StreamTargetsResponseHTML(qw422016 *qt422016.Writer, tsr *targetsStatusResult, filter *requestFilter)
- func StreamTargetsResponsePlain(qw422016 *qt422016.Writer, tsr *targetsStatusResult, filter *requestFilter)
- func TargetRelabelDebugSteps(targetID string, dss []promrelabel.DebugStep, metric, relabelConfigs string, ...) string
- func TargetsResponseHTML(tsr *targetsStatusResult, filter *requestFilter) string
- func TargetsResponsePlain(tsr *targetsStatusResult, filter *requestFilter) string
- func WriteAPIV1Targets(w io.Writer, state string)
- func WriteConfigData(w io.Writer)
- func WriteHumanReadableTargetsStatus(w http.ResponseWriter, r *http.Request)
- func WriteMetricRelabelDebug(w http.ResponseWriter, r *http.Request)
- func WriteMetricRelabelDebugSteps(qq422016 qtio422016.Writer, dss []promrelabel.DebugStep, ...)
- func WriteServiceDiscovery(w http.ResponseWriter, r *http.Request)
- func WriteServiceDiscoveryResponse(qq422016 qtio422016.Writer, tsr *targetsStatusResult, filter *requestFilter)
- func WriteTargetRelabelDebug(w http.ResponseWriter, r *http.Request)
- func WriteTargetRelabelDebugSteps(qq422016 qtio422016.Writer, targetID string, dss []promrelabel.DebugStep, ...)
- func WriteTargetResponse(w http.ResponseWriter, r *http.Request) error
- func WriteTargetsResponseHTML(qq422016 qtio422016.Writer, tsr *targetsStatusResult, filter *requestFilter)
- func WriteTargetsResponsePlain(qq422016 qtio422016.Writer, tsr *targetsStatusResult, filter *requestFilter)
- type Config
- type FileSDConfig
- type GlobalConfig
- type ScrapeConfig
- type ScrapeWork
- type StaticConfig
Constants ¶
This section is empty.
Variables ¶
var ( // PendingScrapeConfigs - zero value means, that // all scrapeConfigs are inited and ready for work. PendingScrapeConfigs int32 )
Functions ¶
func CheckConfig ¶
func CheckConfig() error
CheckConfig checks -promscrape.config for errors and unsupported options.
func Init ¶
func Init(pushData func(at *auth.Token, wr *prompbmarshal.WriteRequest))
Init initializes Prometheus scraper with config from the `-promscrape.config`.
Scraped data is passed to pushData.
func IsDryRun ¶
func IsDryRun() bool
IsDryRun returns true if -promscrape.config.dryRun command-line flag is set
func MetricRelabelDebugSteps ¶
func MetricRelabelDebugSteps(dss []promrelabel.DebugStep, metric, relabelConfigs string, err error) string
func ServiceDiscoveryResponse ¶
func ServiceDiscoveryResponse(tsr *targetsStatusResult, filter *requestFilter) string
func TargetRelabelDebugSteps ¶
func TargetsResponseHTML ¶
func TargetsResponseHTML(tsr *targetsStatusResult, filter *requestFilter) string
func TargetsResponsePlain ¶
func TargetsResponsePlain(tsr *targetsStatusResult, filter *requestFilter) string
func WriteAPIV1Targets ¶
WriteAPIV1Targets writes /api/v1/targets to w according to https://prometheus.io/docs/prometheus/latest/querying/api/#targets
func WriteConfigData ¶
WriteConfigData writes -promscrape.config contents to w
func WriteHumanReadableTargetsStatus ¶
func WriteHumanReadableTargetsStatus(w http.ResponseWriter, r *http.Request)
WriteHumanReadableTargetsStatus writes human-readable status for all the scrape targets to w according to r.
func WriteMetricRelabelDebug ¶
func WriteMetricRelabelDebug(w http.ResponseWriter, r *http.Request)
WriteMetricRelabelDebug serves requests to /metric-relabel-debug page
func WriteMetricRelabelDebugSteps ¶
func WriteMetricRelabelDebugSteps(qq422016 qtio422016.Writer, dss []promrelabel.DebugStep, metric, relabelConfigs string, err error)
func WriteServiceDiscovery ¶
func WriteServiceDiscovery(w http.ResponseWriter, r *http.Request)
WriteServiceDiscovery writes /service-discovery response to w similar to http://demo.robustperception.io:9090/service-discovery
func WriteServiceDiscoveryResponse ¶
func WriteServiceDiscoveryResponse(qq422016 qtio422016.Writer, tsr *targetsStatusResult, filter *requestFilter)
func WriteTargetRelabelDebug ¶
func WriteTargetRelabelDebug(w http.ResponseWriter, r *http.Request)
WriteTargetRelabelDebug generates response for /target-relabel-debug page
func WriteTargetRelabelDebugSteps ¶
func WriteTargetRelabelDebugSteps(qq422016 qtio422016.Writer, targetID string, dss []promrelabel.DebugStep, metric, relabelConfigs string, err error)
func WriteTargetResponse ¶
func WriteTargetResponse(w http.ResponseWriter, r *http.Request) error
WriteTargetResponse serves requests to /target_response?id=<id>
It fetches response for the given target id and returns it.
func WriteTargetsResponseHTML ¶
func WriteTargetsResponseHTML(qq422016 qtio422016.Writer, tsr *targetsStatusResult, filter *requestFilter)
func WriteTargetsResponsePlain ¶
func WriteTargetsResponsePlain(qq422016 qtio422016.Writer, tsr *targetsStatusResult, filter *requestFilter)
Types ¶
type Config ¶
type Config struct { Global GlobalConfig `yaml:"global,omitempty"` ScrapeConfigs []*ScrapeConfig `yaml:"scrape_configs,omitempty"` ScrapeConfigFiles []string `yaml:"scrape_config_files,omitempty"` // contains filtered or unexported fields }
Config represents essential parts from Prometheus config defined at https://prometheus.io/docs/prometheus/latest/configuration/configuration/
type FileSDConfig ¶
type FileSDConfig struct {
Files []string `yaml:"files"`
}
FileSDConfig represents file-based service discovery config.
See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#file_sd_config
type GlobalConfig ¶
type GlobalConfig struct { ScrapeInterval *promutils.Duration `yaml:"scrape_interval,omitempty"` ScrapeTimeout *promutils.Duration `yaml:"scrape_timeout,omitempty"` ExternalLabels *promutils.Labels `yaml:"external_labels,omitempty"` }
GlobalConfig represents essential parts for `global` section of Prometheus config.
See https://prometheus.io/docs/prometheus/latest/configuration/configuration/
type ScrapeConfig ¶
type ScrapeConfig struct { JobName string `yaml:"job_name"` ScrapeInterval *promutils.Duration `yaml:"scrape_interval,omitempty"` ScrapeTimeout *promutils.Duration `yaml:"scrape_timeout,omitempty"` MetricsPath string `yaml:"metrics_path,omitempty"` HonorLabels bool `yaml:"honor_labels,omitempty"` HonorTimestamps *bool `yaml:"honor_timestamps,omitempty"` FollowRedirects *bool `yaml:"follow_redirects,omitempty"` Scheme string `yaml:"scheme,omitempty"` Params map[string][]string `yaml:"params,omitempty"` HTTPClientConfig promauth.HTTPClientConfig `yaml:",inline"` ProxyURL *proxy.URL `yaml:"proxy_url,omitempty"` RelabelConfigs []promrelabel.RelabelConfig `yaml:"relabel_configs,omitempty"` MetricRelabelConfigs []promrelabel.RelabelConfig `yaml:"metric_relabel_configs,omitempty"` SampleLimit int `yaml:"sample_limit,omitempty"` AzureSDConfigs []azure.SDConfig `yaml:"azure_sd_configs,omitempty"` ConsulSDConfigs []consul.SDConfig `yaml:"consul_sd_configs,omitempty"` DigitaloceanSDConfigs []digitalocean.SDConfig `yaml:"digitalocean_sd_configs,omitempty"` DNSSDConfigs []dns.SDConfig `yaml:"dns_sd_configs,omitempty"` DockerSDConfigs []docker.SDConfig `yaml:"docker_sd_configs,omitempty"` DockerSwarmSDConfigs []dockerswarm.SDConfig `yaml:"dockerswarm_sd_configs,omitempty"` EC2SDConfigs []ec2.SDConfig `yaml:"ec2_sd_configs,omitempty"` EurekaSDConfigs []eureka.SDConfig `yaml:"eureka_sd_configs,omitempty"` FileSDConfigs []FileSDConfig `yaml:"file_sd_configs,omitempty"` GCESDConfigs []gce.SDConfig `yaml:"gce_sd_configs,omitempty"` HTTPSDConfigs []http.SDConfig `yaml:"http_sd_configs,omitempty"` KubernetesSDConfigs []kubernetes.SDConfig `yaml:"kubernetes_sd_configs,omitempty"` OpenStackSDConfigs []openstack.SDConfig `yaml:"openstack_sd_configs,omitempty"` StaticConfigs []StaticConfig `yaml:"static_configs,omitempty"` YandexCloudSDConfigs []yandexcloud.SDConfig `yaml:"yandexcloud_sd_configs,omitempty"` // These options are supported only by lib/promscrape. DisableCompression bool `yaml:"disable_compression,omitempty"` DisableKeepAlive bool `yaml:"disable_keepalive,omitempty"` StreamParse bool `yaml:"stream_parse,omitempty"` ScrapeAlignInterval *promutils.Duration `yaml:"scrape_align_interval,omitempty"` ScrapeOffset *promutils.Duration `yaml:"scrape_offset,omitempty"` SeriesLimit int `yaml:"series_limit,omitempty"` NoStaleMarkers *bool `yaml:"no_stale_markers,omitempty"` ProxyClientConfig promauth.ProxyClientConfig `yaml:",inline"` // contains filtered or unexported fields }
ScrapeConfig represents essential parts for `scrape_config` section of Prometheus config.
See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config
type ScrapeWork ¶
type ScrapeWork struct { // Full URL (including query args) for the scrape. ScrapeURL string // Interval for scraping the ScrapeURL. ScrapeInterval time.Duration // Timeout for scraping the ScrapeURL. ScrapeTimeout time.Duration // How to deal with conflicting labels. // See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config HonorLabels bool // How to deal with scraped timestamps. // See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config HonorTimestamps bool // Whether to deny redirects during requests to scrape config. DenyRedirects bool // OriginalLabels contains original labels before relabeling. // // These labels are needed for relabeling troubleshooting at /targets page. // // OriginalLabels are sorted by name. OriginalLabels *promutils.Labels // Labels to add to the scraped metrics. // // The list contains at least the following labels according to https://www.robustperception.io/life-of-a-label/ // // * job // * instance // * user-defined labels set via `relabel_configs` section in `scrape_config` // // See also https://prometheus.io/docs/concepts/jobs_instances/ // // Labels are sorted by name. Labels *promutils.Labels // ExternalLabels contains labels from global->external_labels section of -promscrape.config // // These labels are added to scraped metrics after the relabeling. // See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3137 // // ExternalLabels are sorted by name. ExternalLabels *promutils.Labels // ProxyURL HTTP proxy url ProxyURL *proxy.URL // Auth config for ProxyUR: ProxyAuthConfig *promauth.Config // Auth config AuthConfig *promauth.Config // Optional `relabel_configs`. RelabelConfigs *promrelabel.ParsedConfigs // Optional `metric_relabel_configs`. MetricRelabelConfigs *promrelabel.ParsedConfigs // The maximum number of metrics to scrape after relabeling. SampleLimit int // Whether to disable response compression when querying ScrapeURL. DisableCompression bool // Whether to disable HTTP keep-alive when querying ScrapeURL. DisableKeepAlive bool // Whether to parse target responses in a streaming manner. StreamParse bool // The interval for aligning the first scrape. ScrapeAlignInterval time.Duration // The offset for the first scrape. ScrapeOffset time.Duration // Optional limit on the number of unique series the scrape target can expose. SeriesLimit int // Whether to process stale markers for the given target. // See https://docs.victoriametrics.com/vmagent.html#prometheus-staleness-markers NoStaleMarkers bool //The Tenant Info AuthToken *auth.Token // contains filtered or unexported fields }
ScrapeWork represents a unit of work for scraping Prometheus metrics.
It must be immutable during its lifetime, since it is read from concurrently running goroutines.
type StaticConfig ¶
type StaticConfig struct { Targets []string `yaml:"targets"` Labels *promutils.Labels `yaml:"labels,omitempty"` }
StaticConfig represents essential parts for `static_config` section of Prometheus config.
See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#static_config