Kagome
Polkadot Runtime Engine in C++17
metrics_watcher.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_METRICS_METRICWATCHER
7 #define KAGOME_METRICS_METRICWATCHER
8 
9 #include <thread>
10 
14 #include "metrics/metrics.hpp"
15 #include "outcome/outcome.hpp"
16 
17 namespace kagome::metrics {
18 
19  class MetricsWatcher final {
20  public:
22  std::shared_ptr<application::AppStateManager> app_state_manager,
23  const application::AppConfiguration &app_config,
24  std::shared_ptr<application::ChainSpec> chain_spec);
25 
26  bool prepare();
27  bool start();
28  void stop();
29 
30  private:
31  outcome::result<uintmax_t> measure_storage_size();
32 
33  boost::filesystem::path storage_path_;
34 
35  volatile bool shutdown_requested_ = false;
36  std::thread thread_;
37 
38  // Metrics
41  };
42 
43 } // namespace kagome::metrics
44 
45 #endif // KAGOME_METRICS_METRICWATCHER
outcome::result< uintmax_t > measure_storage_size()
MetricsWatcher(std::shared_ptr< application::AppStateManager > app_state_manager, const application::AppConfiguration &app_config, std::shared_ptr< application::ChainSpec > chain_spec)
metrics::RegistryPtr metrics_registry_
std::unique_ptr< Registry > RegistryPtr
Definition: metrics.hpp:15
boost::filesystem::path storage_path_
A gauge metric to represent a value that can arbitrarily go up and down.
Definition: metrics.hpp:49