lib/promscrape: properly show scrape duration on /targets page

Previously it has been shown as 0.000s for any scrape duration.
This commit is contained in:
Aliaksandr Valialkin 2021-01-11 21:14:44 +02:00
parent bdf67a13cc
commit c97681b45c
2 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@
# tip # tip
* BUGFIX: vmagent: prevent from `dialing to the given TCP address time out` error when scraping big number of unavailable targets. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/987 * BUGFIX: vmagent: prevent from `dialing to the given TCP address time out` error when scraping big number of unavailable targets. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/987
* BUGFIX: vmagent: properly show scrape duration on `/targets` page. Previously it was incorrectly shown as 0.000s.
* BUGFIX: vmalert: return non-empty result in template func `query` stub to pass validation. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/989 . * BUGFIX: vmalert: return non-empty result in template func `query` stub to pass validation. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/989 .
* FEATURE: provide a sample list of alerting rules for VictoriaMetrics components. It is available [here](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/deployment/docker/alerts.yml). * FEATURE: provide a sample list of alerting rules for VictoriaMetrics components. It is available [here](https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/deployment/docker/alerts.yml).

View File

@ -312,7 +312,7 @@ func (tsm *targetStatusMap) getTargetsStatusByJob() []jobTargetsStatuses {
labels: promrelabel.FinalizeLabels(nil, st.sw.Labels), labels: promrelabel.FinalizeLabels(nil, st.sw.Labels),
originalLabels: st.sw.OriginalLabels, originalLabels: st.sw.OriginalLabels,
lastScrapeTime: st.getDurationFromLastScrape(), lastScrapeTime: st.getDurationFromLastScrape(),
scrapeDuration: time.Duration(st.scrapeDuration), scrapeDuration: time.Duration(st.scrapeDuration) * time.Millisecond,
error: errMsg, error: errMsg,
}) })
} }