diff --git a/ydb/core/grpc_services/counters/proxy_counters.cpp b/ydb/core/grpc_services/counters/proxy_counters.cpp index 3973ce39bd83..a5cfeb1e7ce1 100644 --- a/ydb/core/grpc_services/counters/proxy_counters.cpp +++ b/ydb/core/grpc_services/counters/proxy_counters.cpp @@ -17,6 +17,7 @@ class TGRpcProxyCounters : public IGRpcProxyCounters { ::NMonitoring::TDynamicCounters::TCounterPtr DatabaseAccessDenyCounter_; ::NMonitoring::TDynamicCounters::TCounterPtr DatabaseSchemeErrorCounter_; ::NMonitoring::TDynamicCounters::TCounterPtr DatabaseUnavailableCounter_; + ::NMonitoring::TDynamicCounters::TCounterPtr EmptyDatabaseNameCounter_; ::NMonitoring::TDynamicCounters::TCounterPtr DatabaseRateLimitedCounter_; ::NMonitoring::TDynamicCounters::TCounterPtr ConsumedRUCounter_; NMonitoring::THistogramPtr ThrottleDelayHistogram_; @@ -38,6 +39,8 @@ class TGRpcProxyCounters : public IGRpcProxyCounters { DatabaseSchemeErrorCounter_ = group->GetCounter("databaseSchemeError", true); DatabaseUnavailableCounter_ = group->GetCounter("databaseUnavailable", true); + EmptyDatabaseNameCounter_ = group->GetCounter("emptyDatabaseName", true); + DatabaseRateLimitedCounter_ = group->GetCounter("api.grpc.request.throughput_quota_exceeded_count", true); ConsumedRUCounter_ = group->GetCounter("api.grpc.response.consumed_request_units", true); @@ -59,6 +62,10 @@ class TGRpcProxyCounters : public IGRpcProxyCounters { DatabaseUnavailableCounter_->Inc(); } + void IncEmptyDatabaseNameCounter() override { + EmptyDatabaseNameCounter_->Inc(); + } + void IncDatabaseRateLimitedCounter() override { DatabaseRateLimitedCounter_->Inc(); } @@ -274,6 +281,10 @@ class TGRpcProxyCountersWrapper : public IGRpcProxyCounters { Db->IncDatabaseUnavailableCounter(); } + void IncEmptyDatabaseNameCounter() override { + Common->IncEmptyDatabaseNameCounter(); + } + void IncDatabaseRateLimitedCounter() override { Common->IncDatabaseRateLimitedCounter(); Db->IncDatabaseRateLimitedCounter(); diff --git a/ydb/core/grpc_services/counters/proxy_counters.h b/ydb/core/grpc_services/counters/proxy_counters.h index e0cab1082229..60ee64cb220c 100644 --- a/ydb/core/grpc_services/counters/proxy_counters.h +++ b/ydb/core/grpc_services/counters/proxy_counters.h @@ -14,6 +14,7 @@ class IGRpcProxyCounters : public virtual TThrRefBase { virtual void IncDatabaseAccessDenyCounter() = 0; virtual void IncDatabaseSchemeErrorCounter() = 0; virtual void IncDatabaseUnavailableCounter() = 0; + virtual void IncEmptyDatabaseNameCounter() = 0; virtual void IncDatabaseRateLimitedCounter() = 0; virtual void AddConsumedRequestUnits(ui64 requestUnits) = 0; diff --git a/ydb/core/grpc_services/grpc_request_proxy.cpp b/ydb/core/grpc_services/grpc_request_proxy.cpp index f5a7ae83f83e..a3e4f89730f8 100644 --- a/ydb/core/grpc_services/grpc_request_proxy.cpp +++ b/ydb/core/grpc_services/grpc_request_proxy.cpp @@ -193,15 +193,18 @@ class TGRpcRequestProxyImpl if (maybeDatabaseName && !maybeDatabaseName.GetRef().empty()) { databaseName = CanonizePath(maybeDatabaseName.GetRef()); } else { - if (!AllowYdbRequestsWithoutDatabase && DynamicNode && !std::is_same_v) { // TEvRequestAuthAndCheck is allowed to be processed without database - requestBaseCtx->ReplyUnauthenticated("Requests without specified database are not allowed"); - requestBaseCtx->FinishSpan(); - return; - } else { - databaseName = RootDatabase; - skipResourceCheck = true; - skipCheckConnectRights = true; + if (!std::is_same_v) { // TEvRequestAuthAndCheck is allowed to be processed without database + Counters->IncEmptyDatabaseNameCounter(); + if (DynamicNode && !AllowYdbRequestsWithoutDatabase) { + requestBaseCtx->ReplyUnauthenticated("Requests without specified database are not allowed"); + requestBaseCtx->FinishSpan(); + return; + } } + + databaseName = RootDatabase; + skipResourceCheck = true; + skipCheckConnectRights = true; } if (databaseName.empty()) { Counters->IncDatabaseUnavailableCounter();