diff options
author | monster <monster@ydb.tech> | 2022-12-22 16:59:15 +0300 |
---|---|---|
committer | monster <monster@ydb.tech> | 2022-12-22 16:59:15 +0300 |
commit | c385d5ce48538d6c06b1bf63106e035f4fc250fc (patch) | |
tree | da3cdc056d5a09e7bf620de8329beff6812057ff | |
parent | ae0d2d0275506871ad5bc8c40f54efc0c5a93b91 (diff) | |
download | ydb-c385d5ce48538d6c06b1bf63106e035f4fc250fc.tar.gz |
fix simple counters SVP aggregation
-rw-r--r-- | ydb/core/sys_view/common/db_counters.h | 14 | ||||
-rw-r--r-- | ydb/core/sys_view/processor/db_counters.cpp | 3 | ||||
-rw-r--r-- | ydb/core/tablet/private/labeled_db_counters.cpp | 2 |
3 files changed, 11 insertions, 8 deletions
diff --git a/ydb/core/sys_view/common/db_counters.h b/ydb/core/sys_view/common/db_counters.h index fe6b9856e2c..afd0e4386c8 100644 --- a/ydb/core/sys_view/common/db_counters.h +++ b/ydb/core/sys_view/common/db_counters.h @@ -17,6 +17,14 @@ class TDbServiceCounters { THashMap<TString, NKikimrSysView::TDbLabeledCounters*> ByGroupName; public: + void Clear() + { + ProtoCounters.Clear(); + ByTabletType.clear(); + ByGRpcRequest.clear(); + ByGroupName.clear(); + } + void Swap(TDbServiceCounters& other) { ProtoCounters.Swap(&other.ProtoCounters); ByTabletType.swap(other.ByTabletType); @@ -98,12 +106,6 @@ public: return counters; } - - void ClearLabeledCounters() - { - ProtoCounters.Clear(); - ByGroupName.clear(); - } }; } // NSysView diff --git a/ydb/core/sys_view/processor/db_counters.cpp b/ydb/core/sys_view/processor/db_counters.cpp index e31c1432fb7..97f38eb4c5b 100644 --- a/ydb/core/sys_view/processor/db_counters.cpp +++ b/ydb/core/sys_view/processor/db_counters.cpp @@ -240,7 +240,6 @@ static void SwapStatefulCounters(NKikimr::NSysView::TDbServiceCounters* dst, SwapSimpleCounters(dstReq->MutableRequestCounters(), *srcReq.MutableRequestCounters()); } - dst->ClearLabeledCounters(); for (auto& srcReq : *src.MutableLabeledCounters()) { auto* dstReq = dst->FindOrAddLabeledCounters(srcReq.GetAggregatedPerTablets().GetGroup()); SwapLabeledCounters(dstReq->MutableAggregatedPerTablets(), *srcReq.MutableAggregatedPerTablets()); @@ -415,6 +414,7 @@ void TSysViewProcessor::Handle(TEvSysView::TEvSendDbCountersRequest::TPtr& ev) { incomingServicesSet.insert(service); auto& simpleState = state.Simple[service]; + simpleState.Clear(); SwapStatefulCounters(&simpleState, *serviceCounters.MutableCounters()); auto& aggrState = AggregatedCountersState[service]; @@ -473,6 +473,7 @@ void TSysViewProcessor::Handle(TEvSysView::TEvSendDbLabeledCountersRequest::TPtr incomingServicesSet.insert(service); auto& simpleState = state.Simple[service]; + simpleState.Clear(); SwapStatefulCounters(&simpleState, *serviceCounters.MutableCounters()); } diff --git a/ydb/core/tablet/private/labeled_db_counters.cpp b/ydb/core/tablet/private/labeled_db_counters.cpp index f24ccfba7b8..feb0d41a1fe 100644 --- a/ydb/core/tablet/private/labeled_db_counters.cpp +++ b/ydb/core/tablet/private/labeled_db_counters.cpp @@ -79,7 +79,7 @@ TDbLabeledCounters::TDbLabeledCounters(::NMonitoring::TDynamicCounterPtr counter {} void TDbLabeledCounters::ToProto(NKikimr::NSysView::TDbServiceCounters& counters) { - counters.ClearLabeledCounters(); + counters.Clear(); for (auto& bucket : LabeledCountersByGroup.Buckets) { TWriteGuard guard(bucket.GetLock()); for (auto& [group, labeledCounters] : bucket.GetMap()) { |