3#include <userver/formats/json/value.hpp>
5#include <userver/components/component_context.hpp>
6#include <userver/engine/task/task_processor_fwd.hpp>
7#include <userver/server/congestion_control/limiter.hpp>
8#include <userver/server/congestion_control/sensor.hpp>
9#include <userver/server/handlers/fallback_handlers.hpp>
10#include <userver/server/handlers/http_handler_base.hpp>
11#include <userver/storages/secdist/component.hpp>
12#include <userver/utils/statistics/fwd.hpp>
14USERVER_NAMESPACE_BEGIN
19struct StatsAggregation;
23class HttpRequestHandler;
31class Server
final :
public congestion_control::
Limitee,
34 Server(ServerConfig config,
const storages::
secdist::SecdistConfig& secdist,
35 const components::ComponentContext& component_context);
38 const ServerConfig& GetConfig()
const;
40 std::vector<std::string> GetCommonMiddlewares()
const;
42 void WriteMonitorData(utils::statistics::Writer& writer)
const;
44 void WriteTotalHandlerStatistics(utils::statistics::Writer& writer)
const;
46 net::StatsAggregation GetServerStats()
const;
49 engine::TaskProcessor& task_processor);
51 size_t GetThrottlableHandlersCount()
const;
53 const http::HttpRequestHandler& GetHttpRequestHandler(
54 bool is_monitor =
false)
const;
60 RequestsView& GetRequestsView();
62 void SetLimit(std::optional<size_t> new_limit)
override;
64 void SetRpsRatelimit(std::optional<size_t> rps);
66 void SetRpsRatelimitStatusCode(http::
HttpStatus status_code);
68 std::uint64_t GetTotalRequests()
const override;
71 std::unique_ptr<ServerImpl> pimpl;