diff options
author | innokentii <innokentii@yandex-team.com> | 2023-09-18 16:35:05 +0300 |
---|---|---|
committer | innokentii <innokentii@yandex-team.com> | 2023-09-18 16:51:00 +0300 |
commit | 60d18a31807c72a3b253fd5e0f39d3c46d81dd46 (patch) | |
tree | c997b68c0308eb223b5e9f1a6ec309a9e145adc0 | |
parent | 1c59266f8a8b64b9c4f278e84fadd782c2498e1e (diff) | |
download | ydb-60d18a31807c72a3b253fd5e0f39d3c46d81dd46.tar.gz |
Add ratelimiter rpc deadline counting
add rpc deadline counting
-rw-r--r-- | ydb/core/grpc_services/rpc_rate_limiter_api.cpp | 5 | ||||
-rw-r--r-- | ydb/core/quoter/public/quoter.h | 11 | ||||
-rw-r--r-- | ydb/core/quoter/quoter_service.cpp | 6 | ||||
-rw-r--r-- | ydb/core/quoter/quoter_service_impl.h | 3 |
4 files changed, 25 insertions, 0 deletions
diff --git a/ydb/core/grpc_services/rpc_rate_limiter_api.cpp b/ydb/core/grpc_services/rpc_rate_limiter_api.cpp index 5e42e9679b..a5a0a2ec81 100644 --- a/ydb/core/grpc_services/rpc_rate_limiter_api.cpp +++ b/ydb/core/grpc_services/rpc_rate_limiter_api.cpp @@ -433,6 +433,11 @@ public: SendRequest(); } + void OnOperationTimeout(const TActorContext& ctx) { + Send(MakeQuoterServiceID(), new TEvQuota::TEvRpcTimeout(GetProtoRequest()->coordination_node_path(), GetProtoRequest()->resource_path()), 0, 0); + TBase::OnOperationTimeout(ctx); + } + STFUNC(StateFunc) { switch (ev->GetTypeRewrite()) { hFunc(TEvQuota::TEvClearance, Handle); diff --git a/ydb/core/quoter/public/quoter.h b/ydb/core/quoter/public/quoter.h index f8ffdb6833..40a0d64e9b 100644 --- a/ydb/core/quoter/public/quoter.h +++ b/ydb/core/quoter/public/quoter.h @@ -17,6 +17,7 @@ struct TEvQuota { EvRequest = EventSpaceBegin(EEventSpaceQuoter::ES_QUOTA), EvCancelRequest, EvClearance, + EvRpcTimeout, EvProxyRequest = EvRequest + 512, EvProxyStats, @@ -99,6 +100,16 @@ struct TEvQuota { {} }; + struct TEvRpcTimeout : public NActors::TEventLocal<TEvRpcTimeout, EvRpcTimeout> { + const TString Quoter; + const TString Resource; + + TEvRpcTimeout(TString quoter, TString resource) + : Quoter(quoter) + , Resource(resource) + {} + }; + // when cookie present - cancel one request // when cookie omitted - cancel all requests from sender struct TEvCancelRequest : public NActors::TEventLocal<TEvClearance, EvCancelRequest> {}; diff --git a/ydb/core/quoter/quoter_service.cpp b/ydb/core/quoter/quoter_service.cpp index 892c40b0a6..b88481d92c 100644 --- a/ydb/core/quoter/quoter_service.cpp +++ b/ydb/core/quoter/quoter_service.cpp @@ -364,6 +364,7 @@ void TQuoterService::Bootstrap() { Counters.Requests = counters->GetCounter("Requests", true); Counters.ResultOk = counters->GetCounter("ResultOk", true); Counters.ResultDeadline = counters->GetCounter("ResultDeadline", true); + Counters.ResultRpcDeadline = counters->GetCounter("ResultRpcDeadline", true); Counters.ResultError = counters->GetCounter("ResultError", true); Counters.RequestLatency = counters->GetHistogram("RequestLatencyMs", GetLatencyHistogramBuckets()); @@ -1028,6 +1029,11 @@ void TQuoterService::Handle(TEvQuota::TEvProxyUpdate::TPtr &ev) { } } +void TQuoterService::Handle(TEvQuota::TEvRpcTimeout::TPtr &ev) { + Y_UNUSED(ev); + Counters.ResultRpcDeadline->Inc(); +} + void TQuoterService::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev) { THolder<NSchemeCache::TSchemeCacheNavigate> navigate(ev->Get()->Request.Release()); Y_VERIFY(navigate->ResultSet.size() == 1); diff --git a/ydb/core/quoter/quoter_service_impl.h b/ydb/core/quoter/quoter_service_impl.h index bfebafebf9..e4e4d6a804 100644 --- a/ydb/core/quoter/quoter_service_impl.h +++ b/ydb/core/quoter/quoter_service_impl.h @@ -269,6 +269,7 @@ class TQuoterService : public TActorBootstrapped<TQuoterService> { ::NMonitoring::TDynamicCounters::TCounterPtr Requests; ::NMonitoring::TDynamicCounters::TCounterPtr ResultOk; ::NMonitoring::TDynamicCounters::TCounterPtr ResultDeadline; + ::NMonitoring::TDynamicCounters::TCounterPtr ResultRpcDeadline; ::NMonitoring::TDynamicCounters::TCounterPtr ResultError; NMonitoring::THistogramPtr RequestLatency; } Counters; @@ -311,6 +312,7 @@ class TQuoterService : public TActorBootstrapped<TQuoterService> { void Handle(TEvQuota::TEvCancelRequest::TPtr &ev); void Handle(TEvQuota::TEvProxySession::TPtr &ev); void Handle(TEvQuota::TEvProxyUpdate::TPtr &ev); + void Handle(TEvQuota::TEvRpcTimeout::TPtr &ev); void Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev); void HandleTick(); @@ -335,6 +337,7 @@ public: hFunc(TEvQuota::TEvCancelRequest, Handle); hFunc(TEvQuota::TEvProxySession, Handle); hFunc(TEvQuota::TEvProxyUpdate, Handle); + hFunc(TEvQuota::TEvRpcTimeout, Handle); cFunc(TEvents::TEvWakeup::EventType, HandleTick); hFunc(TEvTxProxySchemeCache::TEvNavigateKeySetResult, Handle); default: |