mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promscrape: make a copy of ScrapeWork from discovered []ScrapeWork slice instead of referring to an item in this slice
This should prevent from holding previously discovered []ScrapeWork slices when a part of discovered targets changes over time. This should reduce memory usage for the case when big number of discovered scrape targets changes over time. Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/825
This commit is contained in:
parent
2ec02b7bdb
commit
697fd44158
2 changed files with 5 additions and 3 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
# tip
|
# tip
|
||||||
|
|
||||||
|
* FEATURE: vmagent: reduce memory usage when service discovery detects big number of scrape targets and the set of discovered targets changes over time.
|
||||||
|
See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/825
|
||||||
* FEATURE: vmagent: add `-promscrape.dropOriginalLabels` command-line option, which can be used for reducing memory usage when scraping big number of targets.
|
* FEATURE: vmagent: add `-promscrape.dropOriginalLabels` command-line option, which can be used for reducing memory usage when scraping big number of targets.
|
||||||
See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/825#issuecomment-724308361 for details.
|
See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/825#issuecomment-724308361 for details.
|
||||||
* FEATURE: vmalert: explicitly set extra labels to alert entities. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/870
|
* FEATURE: vmalert: explicitly set extra labels to alert entities. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/870
|
||||||
|
|
|
@ -64,7 +64,7 @@ func (tsm *targetStatusMap) Reset() {
|
||||||
func (tsm *targetStatusMap) Register(sw *ScrapeWork) {
|
func (tsm *targetStatusMap) Register(sw *ScrapeWork) {
|
||||||
tsm.mu.Lock()
|
tsm.mu.Lock()
|
||||||
tsm.m[sw.ID] = targetStatus{
|
tsm.m[sw.ID] = targetStatus{
|
||||||
sw: sw,
|
sw: *sw,
|
||||||
}
|
}
|
||||||
tsm.mu.Unlock()
|
tsm.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ func (tsm *targetStatusMap) Unregister(sw *ScrapeWork) {
|
||||||
func (tsm *targetStatusMap) Update(sw *ScrapeWork, group string, up bool, scrapeTime, scrapeDuration int64, err error) {
|
func (tsm *targetStatusMap) Update(sw *ScrapeWork, group string, up bool, scrapeTime, scrapeDuration int64, err error) {
|
||||||
tsm.mu.Lock()
|
tsm.mu.Lock()
|
||||||
tsm.m[sw.ID] = targetStatus{
|
tsm.m[sw.ID] = targetStatus{
|
||||||
sw: sw,
|
sw: *sw,
|
||||||
up: up,
|
up: up,
|
||||||
scrapeGroup: group,
|
scrapeGroup: group,
|
||||||
scrapeTime: scrapeTime,
|
scrapeTime: scrapeTime,
|
||||||
|
@ -221,7 +221,7 @@ type jobStatus struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type targetStatus struct {
|
type targetStatus struct {
|
||||||
sw *ScrapeWork
|
sw ScrapeWork
|
||||||
up bool
|
up bool
|
||||||
scrapeGroup string
|
scrapeGroup string
|
||||||
scrapeTime int64
|
scrapeTime int64
|
||||||
|
|
Loading…
Reference in a new issue