Skip to content

Commit

Permalink
only register prometheus handlers when prometheus plugin enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
spoonincode committed Jan 4, 2024
1 parent 91dea83 commit 2673730
Showing 1 changed file with 2 additions and 5 deletions.
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

0 comments on commit 2673730

Please sign in to comment.