Skip to content

Commit

Permalink
warn on both flags
Browse files Browse the repository at this point in the history
  • Loading branch information
thepalbi committed Sep 13, 2023
1 parent 3f66ffc commit e9c8eb5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/yace/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func NewYACEApp() *cli.App {
&cli.BoolFlag{
Name: "cloudwatch-concurrency.per-api-enabled",
Value: exporter.DefaultCloudwatchConcurrency.PerAPIEnabled,
Usage: "Whether to enable the per API CloudWatch concurrency limiter.",
Usage: "Whether to enable the per API CloudWatch concurrency limiter. When enabled, the concurrency `-cloudwatch-concurrency` flag will be ignored.",
Destination: &cloudwatchConcurrency.PerAPIEnabled,
},
&cli.IntFlag{
Expand Down Expand Up @@ -233,6 +233,11 @@ func NewYACEApp() *cli.App {
func startScraper(c *cli.Context) error {
logger = logging.NewLogger(logFormat, debug, "version", version)

// log warning if the two concurrency limiting methods are configured via CLI
if c.IsSet("cloudwatch-concurrency") && c.IsSet("cloudwatch-concurrency.per-api-enabled") {
logger.Warn("Both `cloudwatch-concurrency` and `cloudwatch-concurrency.per-api-enabled` are set. `cloudwatch-concurrency` will be ignored, and the per-api concurrency limiting strategy will be favoured.")
}

logger.Info("Parsing config")
if err := cfg.Load(configFile, logger); err != nil {
return fmt.Errorf("Couldn't read %s: %w", configFile, err)
Expand Down

0 comments on commit e9c8eb5

Please sign in to comment.