userver: userver/engine/task_processors_load_monitor.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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/loggable_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::LoggableComponentBase 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
30 public:
31 /// @ingroup userver_component_names
32 /// @brief The default name of engine::TaskProcessorsLoadMonitor
33 static constexpr std::string_view kName{"task-processors-load-monitor"};
34
35 TaskProcessorsLoadMonitor(const components::ComponentConfig& config,
36 const components::ComponentContext& context);
37
38 ~TaskProcessorsLoadMonitor() override;
39
40 static yaml_config::Schema GetStaticConfigSchema();
41
42 private:
43 class Impl;
44 std::unique_ptr<Impl> impl_;
45};
46
47} // namespace engine
48
49template <>
50inline constexpr bool
51 components::kHasValidate<engine::TaskProcessorsLoadMonitor> = true;
52
53template <>
54inline constexpr auto
55 components::kConfigFileMode<engine::TaskProcessorsLoadMonitor> =
57
58USERVER_NAMESPACE_END