mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Apply suggestions from code review
Co-authored-by: Arthur Silva Sens <arthursens2005@gmail.com> Co-authored-by: Ayoub Mrini <ayoubmrini424@gmail.com> Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
This commit is contained in:
parent
f44bba31b3
commit
aa9fef75ac
|
@ -310,10 +310,10 @@ func (c Config) String() string {
|
||||||
// the ones from the scrape_config_files.
|
// the ones from the scrape_config_files.
|
||||||
// This method does not write to config, and it's concurrency safe (the pointer receiver is for efficiency).
|
// This method does not write to config, and it's concurrency safe (the pointer receiver is for efficiency).
|
||||||
// This method also assumes the Config was created by Load, due to races,
|
// This method also assumes the Config was created by Load, due to races,
|
||||||
// read mode https://github.com/prometheus/prometheus/issues/15538.
|
// read more https://github.com/prometheus/prometheus/issues/15538.
|
||||||
func (c *Config) GetScrapeConfigs() ([]*ScrapeConfig, error) {
|
func (c *Config) GetScrapeConfigs() ([]*ScrapeConfig, error) {
|
||||||
if !c.loaded {
|
if !c.loaded {
|
||||||
return nil, errors.New("main config scrape configs was not validated and loaded; GetScrapeConfigs method can only be used on configuration from the config.Load or config.LoadFile")
|
return nil, errors.New("config was not validated and loaded; GetScrapeConfigs method can only be used on configuration from the config.Load or config.LoadFile")
|
||||||
}
|
}
|
||||||
|
|
||||||
scfgs := make([]*ScrapeConfig, len(c.ScrapeConfigs))
|
scfgs := make([]*ScrapeConfig, len(c.ScrapeConfigs))
|
||||||
|
|
Loading…
Reference in a new issue