userver: userver/engine/task_processors_load_monitor.hpp Source File
Loading...
Searching...
No Matches
task_processors_load_monitor.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/engine/task_processors_load_monitor.hpp
4/// @brief @copybrief engine::TaskProcessorsLoadMonitor
5
6#include <memory>
7
8#include <userver/components/component_base.hpp>
9
10USERVER_NAMESPACE_BEGIN
11
12namespace engine {
13
14// clang-format off
15/// @ingroup userver_components
16///
17/// @brief Component to monitor CPU usage for every TaskProcessor present in
18/// the service, and dump per-thread stats into metrics.
19///
20/// ## Static options:
21/// Inherits all the options from components::ComponentBase and adds the
22/// following ones:
23///
24/// Name | Description | Default value
25/// -------------- | ---------------------------------------------- | ---------------------------------
26/// task-processor | name of the TaskProcessor to run monitoring on | default monitoring task processor
27// clang-format on
28class TaskProcessorsLoadMonitor final : public components::ComponentBase {
29public:
30 /// @ingroup userver_component_names
31 /// @brief The default name of engine::TaskProcessorsLoadMonitor
32 static constexpr std::string_view kName{"task-processors-load-monitor"};
33
34 TaskProcessorsLoadMonitor(const components::ComponentConfig& config, const components::ComponentContext& context);
35
36 ~TaskProcessorsLoadMonitor() override;
37
38 static yaml_config::Schema GetStaticConfigSchema();
39
40private:
41 class Impl;
42 std::unique_ptr<Impl> impl_;
43};
44
45} // namespace engine
46
47template <>
48inline constexpr bool components::kHasValidate<engine::TaskProcessorsLoadMonitor> = true;
49
50template <>
51inline constexpr auto components::kConfigFileMode<engine::TaskProcessorsLoadMonitor> = ConfigFileMode::kNotRequired;
52
53USERVER_NAMESPACE_END