Skip to content

Commit

Permalink
Enhanced monitoring for serverless tenants in Hive KIKIMR-19289
Browse files Browse the repository at this point in the history
  • Loading branch information
pixcc committed Dec 25, 2023
1 parent 7116d46 commit 7652655
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion ydb/core/mind/hive/monitoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,49 @@ class TTxMonEvent_MemStateDomains : public TTransactionBase<THive> {
}

void RenderHTMLPage(IOutputStream &out) {
THashMap<TSubDomainKey, size_t> tabletsRunningInObjectDomain;
THashMap<TSubDomainKey, size_t> tabletsRunningInOtherDomains;
THashMap<TSubDomainKey, size_t> tabletsTotal;

for (const auto& [_, tablet] : Self->Tablets) {
const TSubDomainKey objectDomain = tablet.ObjectDomain;
++tabletsTotal[objectDomain];

const TNodeInfo* node = tablet.GetNode();
if (node) {
if (node->GetServicedDomain() == objectDomain) {
++tabletsRunningInObjectDomain[objectDomain];
} else {
++tabletsRunningInOtherDomains[objectDomain];
}
}

for (const auto& follower : tablet.Followers) {
++tabletsTotal[objectDomain];

const TNodeInfo* followerNode = follower.GetNode();
if (followerNode) {
if (followerNode->GetServicedDomain() == objectDomain) {
++tabletsRunningInObjectDomain[objectDomain];
} else {
++tabletsRunningInOtherDomains[objectDomain];
}
}
}
}

// out << "<script>$('.container').css('width', 'auto');</script>";
out << "<table class='table table-sortable'>";
out << "<thead>";
out << "<tr><th>TenantId</th><th>Name</th><th>Hive</th><th>Status</th></tr>";
out << "<tr>";
out << "<th>TenantId</th>";
out << "<th>Name</th>";
out << "<th>Hive</th>";
out << "<th>Status</th>";
out << "<th>TabletsRunningInTenantDomain</th>";
out << "<th>TabletsRunningInOtherDomains</th>";
out << "<th>TabletsTotal</th>";
out << "</tr>";
out << "</thead>";
out << "<tbody>";
for (const auto& [domainKey, domainInfo] : Self->Domains) {
Expand All @@ -482,6 +521,16 @@ class TTxMonEvent_MemStateDomains : public TTransactionBase<THive> {
out << "<td>-</td>";
out << "<td>-</td>";
}
if (tabletsTotal[domainKey] > 0) {
out << "<td>" << std::round(tabletsRunningInObjectDomain[domainKey] * 100.0 / tabletsTotal[domainKey]) << "%"
<< " (" << tabletsRunningInObjectDomain[domainKey] << " of " << tabletsTotal[domainKey] << ")" << "</td>";
out << "<td>" << std::round(tabletsRunningInOtherDomains[domainKey] * 100.0 / tabletsTotal[domainKey]) << "%"
<< " (" << tabletsRunningInOtherDomains[domainKey] << " of " << tabletsTotal[domainKey] << ")" << "</td>";
} else {
out << "<td>-</td>";
out << "<td>-</td>";
}
out << "<td>" << tabletsTotal[domainKey] << "</td>";
out << "</tr>";
}
out << "</tbody>";
Expand Down

0 comments on commit 7652655

Please sign in to comment.