mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
* Fixed concurrent map iteration and map write in Discovery (#3735) * discovery: Changed Lock to RLock in Collect
This commit is contained in:
parent
8b20cb1e8d
commit
66b0aa3b45
|
@ -96,9 +96,11 @@ func (t *TimestampCollector) Collect(ch chan<- prometheus.Metric) {
|
|||
uniqueFiles := make(map[string]float64)
|
||||
t.lock.RLock()
|
||||
for fileSD := range t.discoverers {
|
||||
fileSD.lock.RLock()
|
||||
for filename, timestamp := range fileSD.timestamps {
|
||||
uniqueFiles[filename] = timestamp
|
||||
}
|
||||
fileSD.lock.RUnlock()
|
||||
}
|
||||
t.lock.RUnlock()
|
||||
for filename, timestamp := range uniqueFiles {
|
||||
|
|
Loading…
Reference in a new issue