-
Notifications
You must be signed in to change notification settings - Fork 505
remotecfg: Fix errNotModified handling of metrics and logging #2977
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…printing invalid error logs Fixing behavior of errNotModified and remotecfg_last_load_successful metric. This also prevents invalid error log messages from being printed.
spartan0x117
approved these changes
Mar 12, 2025
Contributor
spartan0x117
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for finding and fixing this!
dehaansa
approved these changes
Mar 12, 2025
Contributor
dehaansa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
Merged
dehaansa
added a commit
that referenced
this pull request
Mar 13, 2025
* remotecfg: Fix errNotModified causing incorrect last_load metric and printing invalid error logs (#2977) Fixing behavior of errNotModified and remotecfg_last_load_successful metric. This also prevents invalid error log messages from being printed. (cherry picked from commit 7350cac) * Fix attribute name in Beyla configuration. (#2966) (cherry picked from commit 5b5752a) * fix: Update `prometheus.exporter.postgresql` to work properly with postgres 17 (#2972) * Add support for postgres17 in prometheus.exporter.postgres * Update changelog * Update docs/sources/reference/components/prometheus/prometheus.exporter.postgres.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --------- Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> (cherry picked from commit 3f52ee7) * Update changelog --------- Co-authored-by: Zachary Sistrunk <zachary@sistrunk.dev> Co-authored-by: Rafael Roquetto <rafaelroquetto@users.noreply.github.com>
towolf
pushed a commit
to towolf/alloy
that referenced
this pull request
Apr 2, 2025
…printing invalid error logs (grafana#2977) Fixing behavior of errNotModified and remotecfg_last_load_successful metric. This also prevents invalid error log messages from being printed.
towolf
pushed a commit
to towolf/alloy
that referenced
this pull request
Apr 2, 2025
…printing invalid error logs (grafana#2977) Fixing behavior of errNotModified and remotecfg_last_load_successful metric. This also prevents invalid error log messages from being printed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#2926 fixed the remotecfg_last_load_successful being set to 1 when an errored config was unchanged, but as a result the behavior is now reversed. The metric is being incorrectly set to 0 when a good config is unchanged. This also has the side effect of spamming the logs with false error messages, as errNotModified gets returned from the function before it can be suppressed by the following if statement.
This PR fixes the issue by simply changing the else to an "else if not errNotModified". This will cause errNotModified to leave the remotecfg_last_load_successful metric unchanged if the config was not modified, as well as allowing the next if statement to suppress the log message from being printed.