fix: set default values for requests_per_second and burst_limit in configuration to prevent rate limiter errors

This commit is contained in:
Arik Jones (aider)
2024-09-30 14:19:00 -05:00
parent e3355269b8
commit 01465a08b7
3 changed files with 32 additions and 0 deletions

View File

@@ -51,6 +51,13 @@ func Load(configPath string) (*Config, error) {
return nil, fmt.Errorf("error parsing config file: %v", err)
}
// Set default values if they are zero or missing
if config.Scrape.RequestsPerSecond <= 0 {
config.Scrape.RequestsPerSecond = 1.0
}
if config.Scrape.BurstLimit <= 0 {
config.Scrape.BurstLimit = 5
}
return &config, nil
}