Skip to content

Add default retry for load config via url#8803

Merged
helenosheaa merged 2 commits intomasterfrom
retry-fetch-config
Feb 12, 2021
Merged

Add default retry for load config via url#8803
helenosheaa merged 2 commits intomasterfrom
retry-fetch-config

Conversation

@helenosheaa
Copy link
Copy Markdown
Member

@helenosheaa helenosheaa commented Feb 4, 2021

Closes #7338

Related #7349, #7662

This is a temporary fix which we intend to improve on:

  • Retries three times at 10s intervals when receiving an error on loading config from a url incase of the endpoint being down.

  • Log attempts and the specific failure response codes.

  • Does not use env variables or add new flags

  • Tests added to demonstrate that on the final failure it will return the error.

Copy link
Copy Markdown
Contributor

@telegraf-tiger telegraf-tiger bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤝 ✅ CLA has been signed. Thank you!

@helenosheaa helenosheaa added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Feb 4, 2021
@helenosheaa helenosheaa requested a review from ssoroka February 9, 2021 19:22
config/config.go Outdated
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("failed to retrieve remote config: %s", resp.Status)
retries := 3
for i := 1; i <= retries; i++ {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if retries is 0, this won't attempt at all. If we later move to user-configurable retries, that won't quite make sense

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right changed i to 0

@helenosheaa helenosheaa requested a review from ssoroka February 11, 2021 16:34
@helenosheaa helenosheaa merged commit 71a3a3c into master Feb 12, 2021
@helenosheaa helenosheaa deleted the retry-fetch-config branch February 12, 2021 16:38
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent won't start if remote HTTP config endpoint is down

3 participants