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:
Bartlomiej Plotka 2024-12-12 10:06:16 +00:00 committed by GitHub
parent f44bba31b3
commit aa9fef75ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -310,10 +310,10 @@ func (c Config) String() string {
// 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 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) {
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))