diff options
author | galaxycrab <UgnineSirdis@ydb.tech> | 2022-07-08 10:56:19 +0300 |
---|---|---|
committer | galaxycrab <UgnineSirdis@ydb.tech> | 2022-07-08 10:56:19 +0300 |
commit | 3f5056deffaa871aa49c77d6bc14d0c49a6b60c2 (patch) | |
tree | fd0dbf540b1ea0a38fc5184ec9fccfe1e2c4b37f /library/cpp | |
parent | d783e97de9fbfbbcec1ff6ef52c8c2515d9b3576 (diff) | |
download | ydb-3f5056deffaa871aa49c77d6bc14d0c49a6b60c2.tar.gz |
Create kesuses for rate limiting in YQ
Fill config in kikimr runner
Create coordination nodes
Pass to config
Protos
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/actors/http/http.h | 22 | ||||
-rw-r--r-- | library/cpp/actors/http/http_proxy.cpp | 4 | ||||
-rw-r--r-- | library/cpp/actors/http/http_proxy.h | 25 |
3 files changed, 32 insertions, 19 deletions
diff --git a/library/cpp/actors/http/http.h b/library/cpp/actors/http/http.h index 318000389c..295b8f97b5 100644 --- a/library/cpp/actors/http/http.h +++ b/library/cpp/actors/http/http.h @@ -54,6 +54,27 @@ struct TEqNoCase { } }; +struct TSensors { + TString Direction; + TString Host; + TString Url; + TString Status; + TDuration Time; + + TSensors( + TStringBuf direction, + TStringBuf host, + TStringBuf url, + TStringBuf status, + TDuration time) + : Direction(direction) + , Host(host) + , Url(url) + , Status(status) + , Time(time) + {} +}; + struct TUrlParameters { THashMap<TStringBuf, TStringBuf> Parameters; @@ -840,6 +861,7 @@ public: // it's temporary accessible for cleanup //protected: THttpIncomingRequestPtr Request; + std::unique_ptr<TSensors> Sensors; }; } diff --git a/library/cpp/actors/http/http_proxy.cpp b/library/cpp/actors/http/http_proxy.cpp index 394cb17bd3..7cf83d38d8 100644 --- a/library/cpp/actors/http/http_proxy.cpp +++ b/library/cpp/actors/http/http_proxy.cpp @@ -260,6 +260,10 @@ TEvHttpProxy::TEvReportSensors* BuildOutgoingRequestSensors(const THttpOutgoingR } TEvHttpProxy::TEvReportSensors* BuildIncomingRequestSensors(const THttpIncomingRequestPtr& request, const THttpOutgoingResponsePtr& response) { + const auto& sensors = response->Sensors; + if (sensors) { + return new TEvHttpProxy::TEvReportSensors(*sensors); + } return new TEvHttpProxy::TEvReportSensors( "in", request->Host, diff --git a/library/cpp/actors/http/http_proxy.h b/library/cpp/actors/http/http_proxy.h index b95954e561..0ed09119e4 100644 --- a/library/cpp/actors/http/http_proxy.h +++ b/library/cpp/actors/http/http_proxy.h @@ -20,7 +20,7 @@ struct TSocketDescriptor : NActors::TSharedDescriptor, THttpConfig { SocketType Socket; TSocketDescriptor() = default; - + TSocketDescriptor(int af) : Socket(af) { @@ -213,24 +213,11 @@ struct TEvHttpProxy { {} }; - struct TEvReportSensors : NActors::TEventLocal<TEvReportSensors, EvReportSensors> { - TString Direction; - TString Host; - TString Url; - TString Status; - TDuration Time; - - TEvReportSensors( - TStringBuf direction, - TStringBuf host, - TStringBuf url, - TStringBuf status, - TDuration time) - : Direction(direction) - , Host(host) - , Url(url) - , Status(status) - , Time(time) + struct TEvReportSensors : TSensors, NActors::TEventLocal<TEvReportSensors, EvReportSensors> { + using TSensors::TSensors; + + TEvReportSensors(const TSensors& sensors) + : TSensors(sensors) {} }; }; |