6 #ifndef KAGOME_TELEMETRY_SERVICE_IMPL_HPP 7 #define KAGOME_TELEMETRY_SERVICE_IMPL_HPP 16 #define RAPIDJSON_NO_SIZETYPEDEFINE 20 #include <rapidjson/document.h> 22 #include <boost/asio/io_context.hpp> 23 #include <libp2p/basic/scheduler.hpp> 24 #include <libp2p/host/host.hpp> 42 std::chrono::seconds(5);
48 public std::enable_shared_from_this<TelemetryService> {
51 std::shared_ptr<application::AppStateManager> app_state_manager,
55 std::shared_ptr<const transaction_pool::TransactionPool> tx_pool,
56 std::shared_ptr<const storage::BufferStorage> buffer_storage,
57 std::shared_ptr<const network::PeerManager> peer_manager);
70 void notifyWasSynchronized()
override;
72 bool isEnabled()
const override;
81 std::vector<TelemetryEndpoint> chainSpecEndpoints()
const;
84 std::string connectedMessage();
87 void frequentNotificationsRoutine();
90 void delayedNotificationsRoutine();
96 void prepareGreetingMessage();
106 std::optional<BlockOrigin> origin);
109 std::string systemIntervalMessage1();
112 std::string systemIntervalMessage2();
115 std::string currentTimestamp()
const;
128 std::shared_ptr<const transaction_pool::TransactionPool>
tx_pool_;
134 volatile bool shutdown_requested_ =
false;
136 using WorkGuardT = boost::asio::executor_work_guard<
137 boost::asio::io_context::executor_type>;
162 bool was_synchronized_ =
false;
167 #endif // KAGOME_TELEMETRY_SERVICE_IMPL_HPP static constexpr auto kTelemetryReportingInterval
std::shared_ptr< boost::asio::io_context > io_context_
const application::ChainSpec & chain_spec_
static constexpr auto kImplementationName
libp2p::basic::Scheduler::Handle delayed_timer_
static constexpr auto kTelemetryMessageMaxLengthBytes
std::shared_ptr< libp2p::basic::Scheduler > scheduler_
static constexpr auto kTelemetrySystemReportInterval
std::shared_ptr< soralog::Logger > Logger
libp2p::basic::Scheduler::Handle frequent_timer_
std::shared_ptr< application::AppStateManager > app_state_manager_
std::shared_ptr< const storage::BufferStorage > buffer_storage_
std::vector< std::shared_ptr< TelemetryConnection > > connections_
std::shared_ptr< std::thread > worker_thread_
std::string genesis_hash_
std::shared_ptr< const network::PeerManager > peer_manager_
const application::AppConfiguration & app_configuration_
const libp2p::Host & host_
common::spin_lock cache_mutex_
static constexpr auto kTelemetryMessagePoolSize
std::shared_ptr< MessagePool > message_pool_
boost::asio::executor_work_guard< boost::asio::io_context::executor_type > WorkGuardT
std::shared_ptr< const transaction_pool::TransactionPool > tx_pool_
std::shared_ptr< WorkGuardT > work_guard_
rapidjson::Document greeting_json_