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

[5.0] only register prometheus handlers when prometheus_plugin enabled; fixing memory leak #2038

Merged
merged 3 commits into from
Jan 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions plugins/prometheus_plugin/prometheus_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@ namespace eosio {
struct prometheus_plugin_impl {

eosio::chain::named_thread_pool<struct prom> _prometheus_thread_pool;
boost::asio::io_context::strand _prometheus_strand;
boost::asio::io_context::strand _prometheus_strand{_prometheus_thread_pool.get_executor()};
metrics::catalog_type _catalog;
fc::microseconds _max_response_time_us;

prometheus_plugin_impl(): _prometheus_strand(_prometheus_thread_pool.get_executor()){
_catalog.register_update_handlers(_prometheus_strand);
}
};

prometheus_plugin::prometheus_plugin()
Expand Down Expand Up @@ -53,6 +49,7 @@ namespace eosio {


void prometheus_plugin::plugin_initialize(const variables_map& options) {
my->_catalog.register_update_handlers(my->_prometheus_strand);

auto& _http_plugin = app().get_plugin<http_plugin>();
my->_max_response_time_us = _http_plugin.get_max_response_time();
Expand Down
Loading