aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordcherednik <dcherednik@ydb.tech>2023-10-18 16:59:47 +0300
committerdcherednik <dcherednik@ydb.tech>2023-10-18 18:00:35 +0300
commit6c65f9e6d7b962d1afc0ef0fa180eba605f29d64 (patch)
treea72c75708e7f446f9a6008fa989806af281c1532
parent4d490d32ee4de930747be21b41778b8854182af0 (diff)
downloadydb-6c65f9e6d7b962d1afc0ef0fa180eba605f29d64.tar.gz
Remove percentile counters for services. This code is broken and must be reimplemented if this feature is realy helpful. KIKIMR-19703
-rw-r--r--ydb/core/grpc_services/counters/counters.cpp98
-rw-r--r--ydb/core/grpc_services/counters/counters.h2
-rw-r--r--ydb/services/kesus/grpc_service.cpp2
-rw-r--r--ydb/services/persqueue_v1/persqueue.cpp4
-rw-r--r--ydb/services/persqueue_v1/topic.cpp4
-rw-r--r--ydb/services/ydb/ydb_dummy.cpp2
6 files changed, 19 insertions, 93 deletions
diff --git a/ydb/core/grpc_services/counters/counters.cpp b/ydb/core/grpc_services/counters/counters.cpp
index 6ac4024f68..ef02d0092c 100644
--- a/ydb/core/grpc_services/counters/counters.cpp
+++ b/ydb/core/grpc_services/counters/counters.cpp
@@ -8,7 +8,6 @@
#include <ydb/public/api/protos/ydb_status_codes.pb.h>
#include <library/cpp/deprecated/enum_codegen/enum_codegen.h>
-#include <library/cpp/monlib/dynamic_counters/percentile/percentile_lg.h>
namespace NKikimr {
namespace NGRpcService {
@@ -99,7 +98,6 @@ struct TYdbRpcCounters {
class TYdbCounterBlock : public NGrpc::ICounterBlock {
protected:
bool Streaming = false;
- bool Percentile = false;
// "Internal" counters
// TODO: Switch to public YDB counters
@@ -115,7 +113,6 @@ protected:
::NMonitoring::TDynamicCounters::TCounterPtr RequestsWithoutDatabase;
::NMonitoring::TDynamicCounters::TCounterPtr RequestsWithoutToken;
::NMonitoring::TDynamicCounters::TCounterPtr RequestsWithoutTls;
- NMonitoring::TPercentileTrackerLg<4, 3, 15> RequestHistMs;
std::array<::NMonitoring::TDynamicCounters::TCounterPtr, 2> GRpcStatusCounters;
TYdbRpcCounters YdbCounters;
@@ -132,7 +129,7 @@ private:
public:
TYdbCounterBlock(const ::NMonitoring::TDynamicCounterPtr& counters, const char* serviceName,
- const char* requestName, bool percentile, bool streaming,
+ const char* requestName, bool streaming,
bool forDatabase = false, ::NMonitoring::TDynamicCounterPtr internalGroup = {});
void CountNotOkRequest() override {
@@ -190,7 +187,7 @@ public:
}
void FinishProcessing(ui32 requestSize, ui32 responseSize, bool ok, ui32 status,
- TDuration requestDuration) override
+ TDuration /*requestDuration*/) override
{
InflyCounter->Dec();
*InflyRequestBytes -= requestSize;
@@ -206,21 +203,11 @@ public:
} else if (!Streaming) {
*GetResponseCounterByStatus(status) += 1;
}
-
- if (Percentile) {
- RequestHistMs.Increment(requestDuration.MilliSeconds());
- }
}
NGrpc::ICounterBlockPtr Clone() override {
return this;
}
-
- void Update() {
- if (Percentile) {
- RequestHistMs.Update();
- }
- }
};
TYdbRpcCounters::TYdbRpcCounters(const ::NMonitoring::TDynamicCounterPtr& counters,
@@ -291,10 +278,9 @@ TYdbRpcCounters::TYdbRpcCounters(const ::NMonitoring::TDynamicCounterPtr& counte
}
TYdbCounterBlock::TYdbCounterBlock(const ::NMonitoring::TDynamicCounterPtr& counters, const char* serviceName,
- const char* requestName, bool percentile, bool streaming,
+ const char* requestName, bool streaming,
bool forDatabase, ::NMonitoring::TDynamicCounterPtr internalGroup)
: Streaming(streaming)
- , Percentile(percentile)
, YdbCounters(counters, serviceName, requestName, forDatabase)
{
// group for all counters
@@ -321,10 +307,6 @@ TYdbCounterBlock::TYdbCounterBlock(const ::NMonitoring::TDynamicCounterPtr& coun
auto subgroup = group->GetSubgroup(streaming ? "stream" : "request", requestName);
TotalCounter = subgroup->GetCounter("total", true);
InflyCounter = subgroup->GetCounter("infly", false);
-
- if (Percentile) {
- RequestHistMs.Initialize(group, "event", "request", "ms", {0.5f, 0.9f, 0.99f, 0.999f, 1.0f});
- }
}
using TYdbCounterBlockPtr = TIntrusivePtr<TYdbCounterBlock>;
@@ -364,9 +346,9 @@ using TYdbCounterBlockPtr = TIntrusivePtr<TYdbCounterBlock>;
class TYdbDbCounterBlock : public TYdbCounterBlock {
public:
TYdbDbCounterBlock(const ::NMonitoring::TDynamicCounterPtr& counters, const char* serviceName,
- const char* requestName, bool percentile, bool streaming,
+ const char* requestName, bool streaming,
::NMonitoring::TDynamicCounterPtr internalGroup = {})
- : TYdbCounterBlock(counters, serviceName, requestName, percentile, streaming, true, internalGroup)
+ : TYdbCounterBlock(counters, serviceName, requestName, streaming, true, internalGroup)
{}
void ToProto(NKikimrSysView::TDbGRpcCounters& counters) {
@@ -459,7 +441,7 @@ public:
}
return CounterBlocks.InsertIfAbsentWithInit(key, [&] {
- return new TYdbDbCounterBlock(Counters, serviceName.c_str(), requestName.c_str(), false, false, InternalGroup);
+ return new TYdbDbCounterBlock(Counters, serviceName.c_str(), requestName.c_str(), false, InternalGroup);
});
}
@@ -540,7 +522,6 @@ class TYdbCounterBlockWrapper : public NGrpc::ICounterBlock {
TYdbCounterBlockPtr Common;
TString ServiceName;
TString RequestName;
- bool Percentile = false;
bool Streaming = false;
::NMonitoring::TDynamicCounterPtr Root;
@@ -548,14 +529,13 @@ class TYdbCounterBlockWrapper : public NGrpc::ICounterBlock {
public:
TYdbCounterBlockWrapper(TYdbCounterBlockPtr common, const TString& serviceName, const TString& requestName,
- bool percentile, bool streaming)
+ bool streaming)
: Common(common)
, ServiceName(serviceName)
, RequestName(requestName)
- , Percentile(percentile)
, Streaming(streaming)
, Root(new ::NMonitoring::TDynamicCounters)
- , Db(new TYdbDbCounterBlock(Root, serviceName.c_str(), requestName.c_str(), percentile, streaming, Root))
+ , Db(new TYdbDbCounterBlock(Root, serviceName.c_str(), requestName.c_str(), streaming, Root))
{}
void CountNotOkRequest() override {
@@ -616,7 +596,7 @@ public:
}
NGrpc::ICounterBlockPtr Clone() override {
- return new TYdbCounterBlockWrapper(Common, ServiceName, RequestName, Percentile, Streaming);
+ return new TYdbCounterBlockWrapper(Common, ServiceName, RequestName, Streaming);
}
void UseDatabase(const TString& database) override {
@@ -631,77 +611,23 @@ public:
}
};
-class TUpdaterActor
- : public TActor<TUpdaterActor>
-{
- TVector<TYdbCounterBlockPtr> Counters;
-
-public:
- enum : ui32 {
- EvRegisterItem = EventSpaceBegin(TEvents::ES_PRIVATE),
- };
-
- struct TEvRegisterItem
- : TEventLocal<TEvRegisterItem, EvRegisterItem>
- {
- TYdbCounterBlockPtr Counters;
-
- TEvRegisterItem(TYdbCounterBlockPtr counters)
- : Counters(std::move(counters))
- {}
- };
-
-public:
- static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
- return NKikimrServices::TActivity::GRPC_UPDATER;
- }
-
- TUpdaterActor()
- : TActor(&TThis::StateFunc)
- {}
-
- void HandleWakeup(const TActorContext& ctx) {
- ctx.Schedule(TDuration::Seconds(1), new TEvents::TEvWakeup);
- for (const auto& counter : Counters) {
- counter->Update();
- }
- }
-
- void Handle(TEvRegisterItem::TPtr& ev, const TActorContext& ctx) {
- Counters.push_back(std::move(ev->Get()->Counters));
- if (Counters.size() == 1) {
- HandleWakeup(ctx);
- }
- }
-
- STRICT_STFUNC(StateFunc, {
- CFunc(TEvents::TSystem::Wakeup, HandleWakeup)
- HFunc(TEvRegisterItem, Handle)
- })
-};
-
TServiceCounterCB::TServiceCounterCB(::NMonitoring::TDynamicCounterPtr counters, TActorSystem *actorSystem)
: Counters(std::move(counters))
, ActorSystem(actorSystem)
{
if (ActorSystem) {
- ActorId = ActorSystem->Register(new TUpdaterActor);
Singleton<TGRpcDbCountersRegistry>()->Initialize(ActorSystem);
}
}
NGrpc::ICounterBlockPtr TServiceCounterCB::operator()(const char* serviceName,
- const char* requestName, bool percentile, bool streaming) const
+ const char* requestName, bool streaming) const
{
- auto block = MakeIntrusive<TYdbCounterBlock>(Counters, serviceName, requestName, percentile, streaming);
-
- if (ActorSystem) {
- ActorSystem->Send(ActorId, new TUpdaterActor::TEvRegisterItem(block));
- }
+ auto block = MakeIntrusive<TYdbCounterBlock>(Counters, serviceName, requestName, streaming);
NGrpc::ICounterBlockPtr res(block);
if (ActorSystem && AppData(ActorSystem)->FeatureFlags.GetEnableDbCounters()) {
- res = MakeIntrusive<TYdbCounterBlockWrapper>(block, serviceName, requestName, percentile, streaming);
+ res = MakeIntrusive<TYdbCounterBlockWrapper>(block, serviceName, requestName, streaming);
}
return res;
diff --git a/ydb/core/grpc_services/counters/counters.h b/ydb/core/grpc_services/counters/counters.h
index 198a415a57..a69adfdc9d 100644
--- a/ydb/core/grpc_services/counters/counters.h
+++ b/ydb/core/grpc_services/counters/counters.h
@@ -12,7 +12,7 @@ public:
TServiceCounterCB(::NMonitoring::TDynamicCounterPtr counters, TActorSystem *actorSystem);
NGrpc::ICounterBlockPtr operator()(const char* serviceName, const char* requestName,
- bool percentile = true, bool streaming = false) const;
+ bool streaming = false) const;
private:
TIntrusivePtr<::NMonitoring::TDynamicCounters> Counters;
diff --git a/ydb/services/kesus/grpc_service.cpp b/ydb/services/kesus/grpc_service.cpp
index 4941d82902..6ad7c8f59b 100644
--- a/ydb/services/kesus/grpc_service.cpp
+++ b/ydb/services/kesus/grpc_service.cpp
@@ -645,7 +645,7 @@ void TKesusGRpcService::SetupIncomingRequests(NGrpc::TLoggerPtr logger) {
},
*ActorSystem_,
"Coordination/Session",
- getCounterBlock("coordination", "Session", true, true),
+ getCounterBlock("coordination", "Session", true),
/* TODO: limiter */ nullptr);
}
diff --git a/ydb/services/persqueue_v1/persqueue.cpp b/ydb/services/persqueue_v1/persqueue.cpp
index 4e3d5db184..99771d1f84 100644
--- a/ydb/services/persqueue_v1/persqueue.cpp
+++ b/ydb/services/persqueue_v1/persqueue.cpp
@@ -50,7 +50,7 @@ void TGRpcPersQueueService::SetupIncomingRequests(NGrpc::TLoggerPtr logger) {
[this](TIntrusivePtr<TStreamGRpcRequest::IContext> context) {
ActorSystem_->Send(GRpcRequestProxyId_, new NKikimr::NGRpcService::TEvStreamPQWriteRequest(context));
},
- *ActorSystem_, "PersQueueService/CreateWriteSession", getCounterBlock("persistent_queue", "WriteSession", true, true), nullptr
+ *ActorSystem_, "PersQueueService/CreateWriteSession", getCounterBlock("persistent_queue", "WriteSession", true), nullptr
);
}
@@ -70,7 +70,7 @@ void TGRpcPersQueueService::SetupIncomingRequests(NGrpc::TLoggerPtr logger) {
[this](TIntrusivePtr<TStreamGRpcRequest::IContext> context) {
ActorSystem_->Send(GRpcRequestProxyId_, new NKikimr::NGRpcService::TEvStreamPQMigrationReadRequest(context));
},
- *ActorSystem_, "PersQueueService/CreateMigrationReadSession", getCounterBlock("persistent_queue", "MigrationReadSession", true, true), nullptr
+ *ActorSystem_, "PersQueueService/CreateMigrationReadSession", getCounterBlock("persistent_queue", "MigrationReadSession", true), nullptr
);
}
diff --git a/ydb/services/persqueue_v1/topic.cpp b/ydb/services/persqueue_v1/topic.cpp
index 42d1a31946..7cd90f1983 100644
--- a/ydb/services/persqueue_v1/topic.cpp
+++ b/ydb/services/persqueue_v1/topic.cpp
@@ -61,7 +61,7 @@ void TGRpcTopicService::SetupIncomingRequests(NGrpc::TLoggerPtr logger) {
[this](TIntrusivePtr<TStreamGRpcRequest::IContext> context) {
ActorSystem_->Send(GRpcRequestProxyId_, new NKikimr::NGRpcService::TEvStreamTopicWriteRequest(context, IsRlAllowed()));
},
- *ActorSystem_, "TopicService/StreamWrite", getCounterBlock("topic", "StreamWrite", true, true), nullptr
+ *ActorSystem_, "TopicService/StreamWrite", getCounterBlock("topic", "StreamWrite", true), nullptr
);
}
@@ -81,7 +81,7 @@ void TGRpcTopicService::SetupIncomingRequests(NGrpc::TLoggerPtr logger) {
[this](TIntrusivePtr<TStreamGRpcRequest::IContext> context) {
ActorSystem_->Send(GRpcRequestProxyId_, new NKikimr::NGRpcService::TEvStreamTopicReadRequest(context, IsRlAllowed()));
},
- *ActorSystem_, "TopicService/StreamRead", getCounterBlock("topic", "StreamRead", true, true), nullptr
+ *ActorSystem_, "TopicService/StreamRead", getCounterBlock("topic", "StreamRead", true), nullptr
);
}
diff --git a/ydb/services/ydb/ydb_dummy.cpp b/ydb/services/ydb/ydb_dummy.cpp
index 5a280d9c30..e07d727f7d 100644
--- a/ydb/services/ydb/ydb_dummy.cpp
+++ b/ydb/services/ydb/ydb_dummy.cpp
@@ -178,7 +178,7 @@ void TGRpcYdbDummyService::SetupIncomingRequests(NGrpc::TLoggerPtr logger) {
},
*ActorSystem_,
"DummyService/BiStreamPing",
- getCounterBlock("dummy", "biStreamPing", true, true),
+ getCounterBlock("dummy", "biStreamPing", true),
nullptr);
}
}