Skip to content

Conversation

@zackman0010
Copy link
Contributor

#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.

…printing invalid error logs

Fixing behavior of errNotModified and remotecfg_last_load_successful metric. This also prevents invalid error log messages from being printed.
@zackman0010 zackman0010 requested a review from a team as a code owner March 12, 2025 18:12
Copy link
Contributor

@spartan0x117 spartan0x117 left a 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!

Copy link
Contributor

@dehaansa dehaansa left a 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!

@dehaansa dehaansa enabled auto-merge (squash) March 12, 2025 19:35
@dehaansa dehaansa merged commit 7350cac into grafana:main Mar 12, 2025
30 checks passed
@zackman0010 zackman0010 deleted the patch-1 branch March 12, 2025 19:44
dehaansa pushed a commit that referenced this pull request Mar 13, 2025
…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)
@dehaansa dehaansa mentioned this pull request Mar 13, 2025
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.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants