mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promscrape: add vm_promscrape_scrapework_cache_* metrics for tracking ScrapeWork cache effectiveness
This commit is contained in:
parent
323af49234
commit
d5058caccc
1 changed files with 7 additions and 0 deletions
|
@ -566,6 +566,7 @@ func newScrapeWorkCache() *scrapeWorkCache {
|
|||
}
|
||||
|
||||
func (swc *scrapeWorkCache) Get(key string) *ScrapeWork {
|
||||
scrapeWorkCacheRequests.Inc()
|
||||
currentTime := fasttime.UnixTimestamp()
|
||||
swc.mu.Lock()
|
||||
swe := swc.m[key]
|
||||
|
@ -576,9 +577,15 @@ func (swc *scrapeWorkCache) Get(key string) *ScrapeWork {
|
|||
if swe == nil {
|
||||
return nil
|
||||
}
|
||||
scrapeWorkCacheHits.Inc()
|
||||
return swe.sw
|
||||
}
|
||||
|
||||
var (
|
||||
scrapeWorkCacheRequests = metrics.NewCounter(`vm_promscrape_scrapework_cache_requests_total`)
|
||||
scrapeWorkCacheHits = metrics.NewCounter(`vm_promscrape_scrapework_cache_hits_total`)
|
||||
)
|
||||
|
||||
func (swc *scrapeWorkCache) Set(key string, sw *ScrapeWork) {
|
||||
currentTime := fasttime.UnixTimestamp()
|
||||
swc.mu.Lock()
|
||||
|
|
Loading…
Reference in a new issue