@@ -119,6 +119,53 @@ bool TNodeFilter::IsAllowedPile(TBridgePileId pile) const {
119119 }
120120}
121121
122+ TMetrics& TMetrics::operator +=(const TMetrics& other) {
123+ CPU += other.CPU ;
124+ Memory += other.Memory ;
125+ Network += other.Network ;
126+ Counter += other.Counter ;
127+ Storage += other.Storage ;
128+ ReadThroughput += other.ReadThroughput ;
129+ WriteThroughput += other.WriteThroughput ;
130+ ReadIops += other.ReadIops ;
131+ WriteIops += other.WriteIops ;
132+ return *this ;
133+ }
134+
135+ void TMetrics::ToProto (NKikimrTabletBase::TMetrics* proto) const {
136+ if (CPU) {
137+ proto->SetCPU (CPU);
138+ }
139+ if (Memory) {
140+ proto->SetMemory (Memory);
141+ }
142+ if (Network) {
143+ proto->SetNetwork (Network);
144+ }
145+ if (Counter) {
146+ proto->SetCounter (Counter);
147+ }
148+ if (Storage) {
149+ proto->SetStorage (Storage);
150+ }
151+ if (ReadThroughput) {
152+ proto->SetReadThroughput (ReadThroughput);
153+ }
154+ if (WriteThroughput) {
155+ proto->SetWriteThroughput (WriteThroughput);
156+ }
157+ if (ReadIops) {
158+ proto->SetReadIops (ReadIops);
159+ }
160+ if (WriteIops) {
161+ proto->SetWriteIops (WriteIops);
162+ }
163+ proto->MutableGroupReadThroughput ()->Assign (GroupReadThroughput.begin (), GroupReadThroughput.end ());
164+ proto->MutableGroupWriteThroughput ()->Assign (GroupWriteThroughput.begin (), GroupWriteThroughput.end ());
165+ proto->MutableGroupReadIops ()->Assign (GroupReadIops.begin (), GroupReadIops.end ());
166+ proto->MutableGroupWriteIops ()->Assign (GroupWriteIops.begin (), GroupWriteIops.end ());
167+ }
168+
122169template <typename K, typename V>
123170std::unordered_map<V, K> MakeReverseMap (const std::unordered_map<K, V>& map) {
124171 std::unordered_map<V, K> result;
0 commit comments