mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-14 16:12:15 +01:00
lib/promscrape: add vm_promscrape_service_discovery_duration_seconds metric
This commit is contained in:
parent
4c59dbc127
commit
755b0998ce
@ -17,6 +17,7 @@ in front of VictoriaMetrics. [Contact us](mailto:sales@victoriametrics.com) if y
|
||||
- `vm_promscrape_discovery_requests_total`
|
||||
- `vm_promscrape_discovery_retries_total`
|
||||
- `vm_promscrape_scrape_retries_total`
|
||||
- `vm_promscrape_service_discovery_duration_seconds`
|
||||
* BUGFIX: vmagent: reduce HTTP reconnection rate for scrape targets. Previously vmagent could errorneusly close HTTP keep-alive connections more frequently than needed.
|
||||
* BUGFIX: vmagent: retry scrape and service discovery requests when the remote server closes HTTP keep-alive connection. Previously `disable_keepalive: true` option could be used under `scrape_configs` section when working with such servers.
|
||||
|
||||
|
@ -180,6 +180,8 @@ func (scs *scrapeConfigs) add(name string, checkInterval time.Duration, getScrap
|
||||
checkInterval: checkInterval,
|
||||
cfgCh: make(chan *Config, 1),
|
||||
stopCh: scs.stopCh,
|
||||
|
||||
discoveryDuration: metrics.GetOrCreateHistogram(fmt.Sprintf("vm_promscrape_service_discovery_duration_seconds{type=%q}", name)),
|
||||
}
|
||||
scs.wg.Add(1)
|
||||
go func() {
|
||||
@ -208,6 +210,8 @@ type scrapeConfig struct {
|
||||
checkInterval time.Duration
|
||||
cfgCh chan *Config
|
||||
stopCh <-chan struct{}
|
||||
|
||||
discoveryDuration *metrics.Histogram
|
||||
}
|
||||
|
||||
func (scfg *scrapeConfig) run() {
|
||||
@ -224,9 +228,11 @@ func (scfg *scrapeConfig) run() {
|
||||
cfg := <-scfg.cfgCh
|
||||
var swsPrev []*ScrapeWork
|
||||
updateScrapeWork := func(cfg *Config) {
|
||||
startTime := time.Now()
|
||||
sws := scfg.getScrapeWork(cfg, swsPrev)
|
||||
sg.update(sws)
|
||||
swsPrev = sws
|
||||
scfg.discoveryDuration.UpdateDuration(startTime)
|
||||
}
|
||||
updateScrapeWork(cfg)
|
||||
atomic.AddInt32(&PendingScrapeConfigs, -1)
|
||||
|
Loading…
Reference in New Issue
Block a user