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

Apply error in loop should not kill the sidecar #2996

Merged
merged 4 commits into from
Aug 7, 2020

Conversation

mneverov
Copy link
Contributor

@mneverov mneverov commented Aug 6, 2020

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Fixes: #2873

Log error when applying changes in the prometheus config instead of stopping the sidecar.
Add new metric reloader_config_errors_total to reflect config readings errors.
Add new flags --reloader.retry-interval and --reloader.watch-interval to tweak corresponding configs for the reloader.

NOTE
I found prometheus.ready_timeout flag with underscore, which seems to be a typo. Please, let me know if it should be changed to prometheus.ready-timeout in this PR (breaking change?).

Verification

To verify it manually add the following flags to the quickstart.sh:

    --reloader.config-file=data/prom"${i}"/prometheus.yml \
    --reloader.retry-interval=5s \
    --reloader.watch-interval=15s

After start, remove/rename data/prom0/prometheus.yml.
The sidecar should still run, the error is logged component=reloader msg="apply error" err="hash file: open data/prom0/prometheus.yml: no such file or directory".
Check metrics: the new metric reloader_config_errors_total is updated.

@mneverov mneverov changed the title WIP Apply error in loop should not kill the sidecar WIP: Apply error in loop should not kill the sidecar Aug 6, 2020
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

I think it looks good for me, but I would add some metric.

PTAL @s-urbaniak @paulfantom from Prometheus Operator perspective (you use config reloader with this package 🤔 )

// Critical error.
// TODO(bwplotka): There is no need to get process down in this case and decrease availability, handle the error in different way.
return err
level.Error(r.logger).Log("msg", "apply error", "err", err)
Copy link
Member

Choose a reason for hiding this comment

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

Can we have metric for that as well? (:

Signed-off-by: Max Neverov <neverov.max@gmail.com>
Signed-off-by: Max Neverov <neverov.max@gmail.com>
@mneverov mneverov marked this pull request as ready for review August 7, 2020 09:41
Signed-off-by: Max Neverov <neverov.max@gmail.com>
@kakkoyun
Copy link
Member

kakkoyun commented Aug 7, 2020

Just to give a heads up @ebabani is also trying fix the same problem #2952

@bwplotka
Copy link
Member

bwplotka commented Aug 7, 2020

This is not the same problem I believe

@kakkoyun
Copy link
Member

kakkoyun commented Aug 7, 2020

Yeah, my mistake not the same problem but the solution is somewhat converging something similar.

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Amazing, solid code. Just one minor suggestion for metric name to be more explicit! 💪

pkg/reloader/reloader.go Outdated Show resolved Hide resolved
pkg/reloader/reloader.go Outdated Show resolved Hide resolved
@bwplotka
Copy link
Member

bwplotka commented Aug 7, 2020

Can we also remove WIP prefix from PR title?

CHANGELOG.md Outdated Show resolved Hide resolved
@mneverov mneverov changed the title WIP: Apply error in loop should not kill the sidecar Apply error in loop should not kill the sidecar Aug 7, 2020
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: Max Neverov <neverov.max@gmail.com>
@mneverov
Copy link
Contributor Author

mneverov commented Aug 7, 2020

@bwplotka applied the changes. Please take a look 🙏
The prometheus.ready_timeout flag will not be addressed here, correct?

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Awesome 👍

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reloader: Apply error in loop should not kill the sidecar.
3 participants