Skip to content

Commit

Permalink
Add lock to global config when making changes
Browse files Browse the repository at this point in the history
  • Loading branch information
haoming29 committed Oct 27, 2023
1 parent aaec4a9 commit 1f7ebde
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions web_ui/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,13 @@ func ConfigureEmbeddedPrometheus(engine *gin.Engine, isDirector bool) error {
// Don't reload scraper config if the instance is not a director
continue
}
globalConfigMtx.Lock()
// Refresh token by manually re-configure scraper
promCfg.ScrapeConfigs[0], err = configDirectorPromScraper()
if err != nil {
return err
}
globalConfigMtx.Unlock()
c := make(map[string]discovery.Configs)
scfgs, err := promCfg.GetScrapeConfigs()
if err != nil {
Expand Down

0 comments on commit 1f7ebde

Please sign in to comment.