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

fix: occasional 500 error when being scraped for metrics #81

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

aeijdenberg
Copy link
Contributor

We are seeing errors on the /metrics end-point suggesting that the same metric is attempted to being exported more than once during the same collect.

I suspect this is because the ttlcache.Range() function doesn't grab a mutex for the entire loop, and that the cleanup or other modication is causing the same values to be emitted more than once during the same iteration.

This change gets a copy of the map then iterates over that, and hopefully stops that error condition from manifesting itself.

(We'll keep an eye on for a while to see if this re-occurs, but wanted to open the PR early in case the previous change is breaking anyone else)

We are seeing errors on the /metrics end-point suggesting that the same metric is attempted to being exported more than once during the same collect.

I suspect this is because the ttlcache.Range() function doesn't grab a mutex for the entire loop, and that the cleanup or other modication is causing the same values to be emitted more than once during the same iteration.

This change gets a copy of the map then iterates over that, and hopefully stops that error condition from manifesting itself.
@rkosegi rkosegi merged commit e40846a into rkosegi:main Apr 25, 2024
1 check passed
Copy link

sonarcloud bot commented Apr 25, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

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.

2 participants