Use rlock in read methods of scrape target
Signed-off-by: Ali Nazari <ali4nazari4@gmail.com>
This commit is contained in:
parent
fe11cae637
commit
f64ee61312
|
|
@ -190,9 +190,9 @@ func (t *Target) LabelsRange(f func(l labels.Label)) {
|
|||
|
||||
// DiscoveredLabels returns a copy of the target's labels before any processing.
|
||||
func (t *Target) DiscoveredLabels(lb *labels.Builder) labels.Labels {
|
||||
t.mtx.Lock()
|
||||
t.mtx.RLock()
|
||||
cfg, tLabels, tgLabels := t.scrapeConfig, t.tLabels, t.tgLabels
|
||||
t.mtx.Unlock()
|
||||
t.mtx.RUnlock()
|
||||
PopulateDiscoveredLabels(lb, cfg, tLabels, tgLabels)
|
||||
return lb.Labels()
|
||||
}
|
||||
|
|
@ -208,9 +208,9 @@ func (t *Target) SetScrapeConfig(scrapeConfig *config.ScrapeConfig, tLabels, tgL
|
|||
|
||||
// URL returns a copy of the target's URL.
|
||||
func (t *Target) URL() *url.URL {
|
||||
t.mtx.Lock()
|
||||
t.mtx.RLock()
|
||||
configParams := t.scrapeConfig.Params
|
||||
t.mtx.Unlock()
|
||||
t.mtx.RUnlock()
|
||||
params := url.Values{}
|
||||
|
||||
for k, v := range configParams {
|
||||
|
|
|
|||
Loading…
Reference in New Issue