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

Change default initialization of PrometheusHandle #52

Merged
merged 8 commits into from
Jul 20, 2024

Conversation

Ptrskay3
Copy link
Owner

@Ptrskay3 Ptrskay3 commented Jun 1, 2024

Addresses #51, based on metrics-rs/metrics#467.

This change prevents unbounded memory growth of metrics histograms by swapping PrometheusHandle::install_recorder to PrometheusHandle::build, that allows the upkeep task to be created, and the data is properly drained.

Other changes:

  • Bump metrics to 0.23, metrics-exporter-prometheus to 0.15.
  • Document current MSRV

TODO:

  • Figure out what to do when push-gateway is enabled.

@Ptrskay3 Ptrskay3 added enhancement New feature or request WIP Work in progress labels Jun 1, 2024
@Ptrskay3 Ptrskay3 self-assigned this Jun 1, 2024
@Ptrskay3
Copy link
Owner Author

Finally found the time to fix this issue. I tested the changes locally, and it no longer produces unbounded memory growth for me. Nonetheless, it'd be great to hear some feedback from someone else too before merging. Also, does it make sense to specify a default 5 seconds upkeep_timeout for most users?

cc @gauravkumar37, @tobz, maybe @yanns

@yanns
Copy link
Contributor

yanns commented Jun 13, 2024

I really appreciate this change, thanks!
In my company, for other services in different languages, we are using a different approach. Whenever the metrics are fetched, we use that information to reset the metrics.
By using a timeout, I guess that one should use a time that is more than the scrape interval (1 minute in our case)
I can check this change later to see how it behaves.

@tobz
Copy link

tobz commented Jun 18, 2024

To my eyes, this looks right. 👍🏻

@Ptrskay3 Ptrskay3 marked this pull request as ready for review July 20, 2024 09:06
@Ptrskay3
Copy link
Owner Author

I'll go ahead and merge this as-is. I'll get back to handling the push gateway feature in a different PR.

@Ptrskay3 Ptrskay3 merged commit 0bcc34f into master Jul 20, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants