Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/datadog] Add api.fail_on_invalid_key to fail fast if API Key is invalid #9426

Merged
merged 11 commits into from
May 5, 2022
Prev Previous commit
Next Next commit
avoid failing when a transient network error
  • Loading branch information
keisku committed Apr 27, 2022
commit f375265e0cfd2b4755556897013c2a2d722c82ea
4 changes: 1 addition & 3 deletions exporter/datadogexporter/internal/utils/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ func ValidateAPIKey(logger *zap.Logger, client *datadog.Client, failOnInvalidKey
return
}
switch {
case err != nil && failOnInvalidKey:
logger.Fatal("Error while validating API key.", zap.Error(err))
case err != nil && !failOnInvalidKey:
case err != nil:
logger.Warn("Error while validating API key.", zap.Error(err))
case !valid && failOnInvalidKey:
logger.Fatal("API Key validation failed.")
keisku marked this conversation as resolved.
Show resolved Hide resolved
Expand Down