6#include <userver/components/component_base.hpp>
7#include <userver/components/component_fwd.hpp>
8#include <userver/concurrent/variable.hpp>
9#include <userver/engine/task/task_processor_fwd.hpp>
10#include <userver/utils/periodic_task.hpp>
11#include <utils/statistics/system_statistics.hpp>
13USERVER_NAMESPACE_BEGIN
32class SystemStatisticsCollector
final :
public ComponentBase {
36 static constexpr std::string_view
kName =
"system-statistics-collector";
38 SystemStatisticsCollector(
const ComponentConfig&,
const ComponentContext&);
40 static yaml_config::Schema GetStaticConfigSchema();
43 void ExtendStatistics(utils::statistics::Writer& writer);
48 utils::statistics::impl::SystemStats last_stats{};
49 utils::statistics::impl::SystemStats last_nginx_stats{};
52 const bool with_nginx_;
53 engine::TaskProcessor& fs_task_processor_;
54 concurrent::Variable<Data> data_;
55 utils::PeriodicTask periodic_;
59inline constexpr bool kHasValidate<SystemStatisticsCollector> =
true;