diff options
author | zalyalov <zalyalov@yandex-team.com> | 2023-08-02 08:48:27 +0300 |
---|---|---|
committer | zalyalov <zalyalov@yandex-team.com> | 2023-08-02 08:48:27 +0300 |
commit | 614c0ff5ae7554419a2df08ff34f43542bd348cb (patch) | |
tree | f455dae5439f84d6fada61609e1378f3bc2407a1 | |
parent | 0a57551e82ba1f0e1ab1c1d3ca19599be7ecaeac (diff) | |
download | ydb-614c0ff5ae7554419a2df08ff34f43542bd348cb.tar.gz |
add sensors on node count KIKIMR-17973
-rw-r--r-- | ydb/core/mind/hive/hive_impl.cpp | 10 | ||||
-rw-r--r-- | ydb/core/mind/hive/hive_impl.h | 1 | ||||
-rw-r--r-- | ydb/core/mind/hive/node_info.cpp | 2 | ||||
-rw-r--r-- | ydb/core/mind/hive/tx__load_everything.cpp | 1 | ||||
-rw-r--r-- | ydb/core/protos/counters_hive.proto | 2 |
5 files changed, 16 insertions, 0 deletions
diff --git a/ydb/core/mind/hive/hive_impl.cpp b/ydb/core/mind/hive/hive_impl.cpp index e1a11a7860..c5737c0d40 100644 --- a/ydb/core/mind/hive/hive_impl.cpp +++ b/ydb/core/mind/hive/hive_impl.cpp @@ -1383,6 +1383,7 @@ TNodeInfo& THive::GetNode(TNodeId nodeId) { auto it = Nodes.find(nodeId); if (it == Nodes.end()) { it = Nodes.emplace(std::piecewise_construct, std::tuple<TNodeId>(nodeId), std::tuple<TNodeId, THive&>(nodeId, *this)).first; + TabletCounters->Simple()[NHive::COUNTER_NODES_TOTAL].Add(1); } return it->second; } @@ -1502,6 +1503,7 @@ void THive::DeleteTablet(TTabletId tabletId) { } void THive::DeleteNode(TNodeId nodeId) { + TabletCounters->Simple()[NHive::COUNTER_NODES_TOTAL].Sub(1); Nodes.erase(nodeId); } @@ -1569,6 +1571,14 @@ void THive::UpdateCounterEventQueueSize(i64 eventQueueSizeDiff) { } } +void THive::UpdateCounterNodesConnected(i64 nodesConnectedDiff) { + if (TabletCounters != nullptr) { + auto& counter = TabletCounters->Simple()[NHive::COUNTER_NODES_CONNECTED]; + auto newValue = counter.Get() + nodesConnectedDiff; + counter.Set(newValue); + } +} + void THive::RecordTabletMove(const TTabletMoveInfo& moveInfo) { TabletMoveHistory.PushBack(moveInfo); TabletCounters->Cumulative()[NHive::COUNTER_TABLETS_MOVED].Increment(1); diff --git a/ydb/core/mind/hive/hive_impl.h b/ydb/core/mind/hive/hive_impl.h index e43b7aec95..fdd83d1058 100644 --- a/ydb/core/mind/hive/hive_impl.h +++ b/ydb/core/mind/hive/hive_impl.h @@ -611,6 +611,7 @@ public: void UpdateCounterTabletsAlive(i64 tabletsAliveDiff); void UpdateCounterBootQueueSize(ui64 bootQueueSize); void UpdateCounterEventQueueSize(i64 eventQueueSizeDiff); + void UpdateCounterNodesConnected(i64 nodesConnectedDiff); void RecordTabletMove(const TTabletMoveInfo& info); bool DomainHasNodes(const TSubDomainKey &domainKey) const; void ProcessBootQueue(); diff --git a/ydb/core/mind/hive/node_info.cpp b/ydb/core/mind/hive/node_info.cpp index 104e0a2705..0033986add 100644 --- a/ydb/core/mind/hive/node_info.cpp +++ b/ydb/core/mind/hive/node_info.cpp @@ -30,6 +30,7 @@ void TNodeInfo::ChangeVolatileState(EVolatileState state) { case EVolatileState::Disconnected: case EVolatileState::Connecting: RegisterInDomains(); + Hive.UpdateCounterNodesConnected(+1); break; default: @@ -42,6 +43,7 @@ void TNodeInfo::ChangeVolatileState(EVolatileState state) { case EVolatileState::Connected: case EVolatileState::Disconnecting: DeregisterInDomains(); + Hive.UpdateCounterNodesConnected(-1); break; default: diff --git a/ydb/core/mind/hive/tx__load_everything.cpp b/ydb/core/mind/hive/tx__load_everything.cpp index 7dcf9ae246..f152458597 100644 --- a/ydb/core/mind/hive/tx__load_everything.cpp +++ b/ydb/core/mind/hive/tx__load_everything.cpp @@ -712,6 +712,7 @@ public: Self->SetCounterTabletsTotal(tabletsTotal); Self->TabletCounters->Simple()[NHive::COUNTER_SEQUENCE_FREE].Set(Self->Sequencer.FreeSize()); Self->TabletCounters->Simple()[NHive::COUNTER_SEQUENCE_ALLOCATED].Set(Self->Sequencer.AllocatedSequencesSize()); + Self->TabletCounters->Simple()[NHive::COUNTER_NODES_TOTAL].Set(Self->Nodes.size()); Self->MigrationState = NKikimrHive::EMigrationState::MIGRATION_READY; ctx.Send(Self->SelfId(), new TEvPrivate::TEvBootTablets()); diff --git a/ydb/core/protos/counters_hive.proto b/ydb/core/protos/counters_hive.proto index b84e986807..e62a1c02e7 100644 --- a/ydb/core/protos/counters_hive.proto +++ b/ydb/core/protos/counters_hive.proto @@ -23,6 +23,8 @@ enum ESimpleCounters { COUNTER_SEQUENCE_FREE = 13 [(CounterOpts) = {Name: "SequenceFree"}]; COUNTER_SEQUENCE_ALLOCATED = 14 [(CounterOpts) = {Name: "SequenceAllocated"}]; COUNTER_EVENTQUEUE_SIZE = 15 [(CounterOpts) = {Name: "EventQueueSize"}]; + COUNTER_NODES_TOTAL = 16 [(CounterOpts) = {Name: "NodesTotal"}]; + COUNTER_NODES_CONNECTED = 17 [(CounterOpts) = {Name: "NodesConnected"}]; } enum ECumulativeCounters { |