Skip to content

Commit

Permalink
Show exclusive nodes in embedded ui KIKIMR-20675 (ydb-platform#1149)
Browse files Browse the repository at this point in the history
* Show exclusive nodes in embedded ui KIKIMR-20675
  • Loading branch information
pixcc authored Jan 24, 2024
1 parent 8a21d0e commit 37b3086
Show file tree
Hide file tree
Showing 4 changed files with 379 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ydb/core/viewer/json_compute.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ class TJsonCompute : public TViewerPipeClient<TJsonCompute> {
for (const NKikimrHive::THiveNodeStats& nodeStat : nodeStats) {
auto nodeId = nodeStat.GetNodeId();
if (IsRequiredNode(nodeId)) {
const auto& nodeDomain = nodeStat.GetNodeDomain();
const TPathId subDomain(nodeDomain.GetSchemeShard(), nodeDomain.GetPathId());
if (FilterSubDomain && FilterSubDomain != subDomain) {
continue;
}
NodeIds.emplace_back(nodeId); // order is important
TActorId whiteboardServiceId = MakeNodeWhiteboardServiceId(nodeId);
THolder<NNodeWhiteboard::TEvWhiteboard::TEvSystemStateRequest> request = MakeHolder<NNodeWhiteboard::TEvWhiteboard::TEvSystemStateRequest>();
Expand Down
16 changes: 15 additions & 1 deletion ydb/core/viewer/json_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class TJsonNodes : public TViewerPipeClient<TJsonNodes> {
TJsonSettings JsonSettings;
ui32 Timeout = 0;
TString FilterTenant;
TSubDomainKey FilterSubDomainKey;
TString FilterPath;
TString FilterStoragePool;
std::unordered_set<TNodeId> FilterNodeIds;
Expand Down Expand Up @@ -405,6 +406,11 @@ class TJsonNodes : public TViewerPipeClient<TJsonNodes> {
if (HiveId == 0) {
HiveId = entry.DomainInfo->Params.GetHive();
}
if (!FilterSubDomainKey) {
const auto ownerId = entry.DomainInfo->DomainKey.OwnerId;
const auto localPathId = entry.DomainInfo->DomainKey.LocalPathId;
FilterSubDomainKey = TSubDomainKey(ownerId, localPathId);
}
if (entry.DomainInfo->ResourcesDomainKey && entry.DomainInfo->DomainKey != entry.DomainInfo->ResourcesDomainKey) {
TPathId resourceDomainKey(entry.DomainInfo->ResourcesDomainKey);
BLOG_TRACE("Requesting navigate for resource domain " << resourceDomainKey);
Expand Down Expand Up @@ -461,6 +467,10 @@ class TJsonNodes : public TViewerPipeClient<TJsonNodes> {
void Handle(TEvHive::TEvResponseHiveNodeStats::TPtr& ev) {
BLOG_TRACE("ResponseHiveNodeStats()");
for (const NKikimrHive::THiveNodeStats& nodeStats : ev->Get()->Record.GetNodeStats()) {
const TSubDomainKey nodeSubDomainKey = TSubDomainKey(nodeStats.GetNodeDomain());
if (FilterSubDomainKey && FilterSubDomainKey != nodeSubDomainKey) {
continue;
}
ui32 nodeId = nodeStats.GetNodeId();
auto& tabletInfo(TabletInfo[nodeId]);
for (const NKikimrHive::THiveDomainStatsStateCount& stateStats : nodeStats.GetStateStats()) {
Expand Down Expand Up @@ -514,14 +524,18 @@ class TJsonNodes : public TViewerPipeClient<TJsonNodes> {
}

void Handle(TEvStateStorage::TEvBoardInfo::TPtr& ev) {
BLOG_TRACE("Received TEvBoardInfo");
if (ev->Get()->Status == TEvStateStorage::TEvBoardInfo::EStatus::Ok) {
BLOG_TRACE("Received TEvBoardInfo");
for (const auto& [actorId, infoEntry] : ev->Get()->InfoEntries) {
auto nodeId(actorId.NodeId());
BLOG_TRACE("BoardInfo filter node by " << nodeId);
FilterNodeIds.insert(nodeId);
}
} else {
BLOG_TRACE("Error receiving TEvBoardInfo response");
FilterNodeIds = { 0 };
}

if (--RequestsBeforeNodeList == 0) {
ProcessNodeIds();
}
Expand Down
9 changes: 6 additions & 3 deletions ydb/core/viewer/json_tenantinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,12 @@ class TJsonTenantInfo : public TViewerPipeClient<TJsonTenantInfo> {

if (tenant.GetType() == NKikimrViewer::Serverless) {
tenant.SetStorageAllocatedSize(tenant.GetMetrics().GetStorage());
tenant.SetMemoryUsed(tenant.GetMetrics().GetMemory());
tenant.ClearMemoryLimit();
tenant.SetCoresUsed(static_cast<double>(tenant.GetMetrics().GetCPU()) / 1000000);
const bool noExclusiveNodes = tenantNodes.empty();
if (noExclusiveNodes) {
tenant.SetMemoryUsed(tenant.GetMetrics().GetMemory());
tenant.ClearMemoryLimit();
tenant.SetCoresUsed(static_cast<double>(tenant.GetMetrics().GetCPU()) / 1000000);
}
}

if (Tablets) {
Expand Down
Loading

0 comments on commit 37b3086

Please sign in to comment.