@@ -109,6 +109,7 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
109109 ui64 UserPoolUsage = 0 ; // (usage uS x threads) / sec
110110 ui64 MemUsage = 0 ;
111111 ui64 MemLimit = 0 ;
112+ ui64 CpuLimit = 0 ; // PotentialMaxThreadCount of UserPool
112113 double NodeUsage = 0 ;
113114
114115 bool SentDrainNode = false ;
@@ -272,28 +273,28 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
272273 HandlePipeDestroyed (ctx);
273274 }
274275
275- void SendStatusOk (const TActorContext &ctx) {
276- LOG_DEBUG_S (ctx, NKikimrServices::LOCAL, " TLocalNodeRegistrar SendStatusOk" );
277- TAutoPtr<TEvLocal::TEvStatus> eventStatus = new TEvLocal::TEvStatus (TEvLocal::TEvStatus::StatusOk);
278- auto & record = eventStatus->Record ;
279- record.SetStartTime (StartTime.GetValue ());
280- record.MutableResourceMaximum ()->CopyFrom (ResourceLimit);
281- if (!record.GetResourceMaximum ().HasCPU ()) {
282- TExecutorPoolStats poolStats;
283- TVector<TExecutorThreadStats> statsCopy;
284- TVector<TExecutorThreadStats> sharedStatsCopy;
285- ctx.ExecutorThread .ActorSystem ->GetPoolStats (AppData ()->UserPoolId , poolStats, statsCopy, sharedStatsCopy);
286- if (!statsCopy.empty ()) {
287- record.MutableResourceMaximum ()->SetCPU (poolStats.CurrentThreadCount * 1000000 );
276+ void FillResourceMaximum (NKikimrTabletBase::TMetrics* record) {
277+ record->CopyFrom (ResourceLimit);
278+ if (!record->HasCPU ()) {
279+ if (CpuLimit != 0 ) {
280+ record->SetCPU (CpuLimit);
288281 }
289282 }
290- if (!record. GetResourceMaximum (). HasMemory ()) {
283+ if (!record-> HasMemory ()) {
291284 if (MemLimit != 0 ) {
292- record. MutableResourceMaximum () ->SetMemory (MemLimit);
285+ record->SetMemory (MemLimit);
293286 } else {
294- record. MutableResourceMaximum () ->SetMemory (NSystemInfo::TotalMemorySize ());
287+ record->SetMemory (NSystemInfo::TotalMemorySize ());
295288 }
296289 }
290+ }
291+
292+ void SendStatusOk (const TActorContext &ctx) {
293+ LOG_DEBUG_S (ctx, NKikimrServices::LOCAL, " TLocalNodeRegistrar SendStatusOk" );
294+ TAutoPtr<TEvLocal::TEvStatus> eventStatus = new TEvLocal::TEvStatus (TEvLocal::TEvStatus::StatusOk);
295+ auto & record = eventStatus->Record ;
296+ record.SetStartTime (StartTime.GetValue ());
297+ FillResourceMaximum (record.MutableResourceMaximum ());
297298 NTabletPipe::SendData (ctx, HivePipeClient, eventStatus.Release ());
298299 }
299300
@@ -587,6 +588,7 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
587588 record.MutableTotalResourceUsage ()->SetMemory (MemUsage);
588589 }
589590 record.SetTotalNodeUsage (NodeUsage);
591+ FillResourceMaximum (record.MutableResourceMaximum ());
590592 NTabletPipe::SendData (ctx, HivePipeClient, event.Release ());
591593 SendTabletMetricsTime = ctx.Now ();
592594 } else {
@@ -649,7 +651,8 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
649651 const NKikimrWhiteboard::TSystemStateInfo& info = record.GetSystemStateInfo (0 );
650652 if (static_cast <ui32>(info.PoolStatsSize ()) > AppData ()->UserPoolId ) {
651653 const auto & poolStats (info.GetPoolStats (AppData ()->UserPoolId ));
652- UserPoolUsage = poolStats.usage () * poolStats.threads () * 1000000 ; // uS
654+ CpuLimit = poolStats.limit () * 1'000'000 ; // microseconds
655+ UserPoolUsage = poolStats.usage () * CpuLimit; // microseconds
653656 }
654657
655658 // Note: we use allocated memory because MemoryUsed(AnonRSS) has lag
0 commit comments