userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
system_statistics_collector.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/utils/statistics/system_statistics_collector.hpp
4
/// @brief @copybrief components::SystemStatisticsCollector
5
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
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
components
{
16
17
/// @ingroup userver_components
18
///
19
/// @brief Component for system resource usage statistics collection.
20
///
21
/// Periodically queries resource usage info and reports is as a set of metrics.
22
///
23
/// ## Static options of components::SystemStatisticsCollector :
24
/// @include{doc} scripts/docs/en/components_schema/core/src/utils/statistics/system_statistics_collector.md
25
///
26
/// Options inherited from @ref components::ComponentBase :
27
/// @include{doc} scripts/docs/en/components_schema/core/src/components/impl/component_base.md
28
///
29
/// ## Static configuration example:
30
///
31
/// @snippet components/common_component_list_test.cpp Sample system statistics component config
32
class
SystemStatisticsCollector
final
:
public
ComponentBase
{
33
public
:
34
/// @ingroup userver_component_names
35
/// @brief The default name of @ref components::SystemStatisticsCollector
36
static
constexpr
std::string_view
kName
=
"system-statistics-collector"
;
37
38
SystemStatisticsCollector(
const
ComponentConfig&,
const
ComponentContext&);
39
40
static
yaml_config::Schema GetStaticConfigSchema();
41
42
private
:
43
void
ExtendStatistics(
utils
::
statistics
::Writer& writer);
44
45
void
ProcessTimer();
46
47
struct
Data {
48
utils
::
statistics
::impl::SystemStats last_stats{};
49
utils
::
statistics
::impl::SystemStats last_nginx_stats{};
50
};
51
52
const
bool
with_nginx_;
53
engine::TaskProcessor& fs_task_processor_;
54
concurrent
::Variable<Data> data_;
55
utils
::PeriodicTask periodic_;
56
};
57
58
template
<>
59
inline
constexpr
bool
kHasValidate<SystemStatisticsCollector> =
true
;
60
61
}
// namespace components
62
63
USERVER_NAMESPACE_END
userver
utils
statistics
system_statistics_collector.hpp
Generated on
for userver by
Doxygen
1.17.0