5#include <userver/congestion_control/sensor.hpp>
6#include <userver/engine/task/task_processor_fwd.hpp>
7#include <userver/rcu/rcu.hpp>
8#include <userver/utils/statistics/recentperiod.hpp>
10USERVER_NAMESPACE_BEGIN
12namespace server::congestion_control {
16 virtual ~RequestsSource() =
default;
18 virtual std::uint64_t GetTotalRequests()
const = 0;
21class Sensor
final :
public USERVER_NAMESPACE::congestion_control::
Sensor {
23 explicit Sensor(engine::TaskProcessor& tp);
30 engine::TaskProcessor& tp_;
31 rcu::Variable<std::vector<RequestsSource*>> requests_sources_;
33 std::chrono::steady_clock::time_point last_fetch_tp_;
34 std::uint64_t last_overloads_{0};
35 std::uint64_t last_no_overloads_{0};
36 std::uint64_t last_requests_{0};