Kagome
Polkadot Runtime Engine in C++17
exposer_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_METRICS_IMPL_EXPOSER_IMPL_HPP
7 #define KAGOME_CORE_METRICS_IMPL_EXPOSER_IMPL_HPP
8 
9 #include <thread>
10 
12 #include "log/logger.hpp"
13 #include "metrics/exposer.hpp"
14 
15 namespace kagome::metrics {
16 
17  class ExposerImpl : public Exposer,
18  public std::enable_shared_from_this<ExposerImpl> {
20 
21  public:
23  const std::shared_ptr<application::AppStateManager> &app_state_manager,
24  Exposer::Configuration exposer_config,
25  Session::Configuration session_config);
26 
27  ~ExposerImpl() override = default;
28 
29  bool prepare() override;
30  bool start() override;
31  void stop() override;
32 
33  private:
34  void acceptOnce();
35 
36  std::shared_ptr<Context> context_;
37  const Configuration config_;
39 
40  std::unique_ptr<Acceptor> acceptor_;
41 
42  std::shared_ptr<Session> new_session_;
43 
44  std::shared_ptr<std::thread> thread_;
45  };
46 
47 } // namespace kagome::metrics
48 
49 #endif // KAGOME_CORE_METRICS_IMPL_EXPOSER_IMPL_HPP
std::shared_ptr< std::thread > thread_
std::unique_ptr< Acceptor > acceptor_
bool start() override
start interface for AppStateManager
std::shared_ptr< Session > new_session_
ExposerImpl(const std::shared_ptr< application::AppStateManager > &app_state_manager, Exposer::Configuration exposer_config, Session::Configuration session_config)
const Session::Configuration session_config_
~ExposerImpl() override=default
std::shared_ptr< soralog::Logger > Logger
Definition: logger.hpp:23
const Configuration config_
bool prepare() override
prepare interface for AppStateManager
void stop() override
stop interface for AppStateManager
an http server interface to expose metrics on request with custom request handler ...
Definition: exposer.hpp:21
std::shared_ptr< Context > context_