Skip to content

Commit 2f5ea7d

Browse files
committed
Enhanced monitoring for serverless tenants in Hive KIKIMR-19289
1 parent 2eb3833 commit 2f5ea7d

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

ydb/core/mind/hive/monitoring.cpp

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,49 @@ class TTxMonEvent_MemStateDomains : public TTransactionBase<THive> {
456456
}
457457

458458
void RenderHTMLPage(IOutputStream &out) {
459+
THashMap<TSubDomainKey, size_t> tabletsRunningInObjectDomain;
460+
THashMap<TSubDomainKey, size_t> tabletsRunningInOtherDomains;
461+
THashMap<TSubDomainKey, size_t> tabletsTotal;
462+
463+
for (const auto& [_, tablet] : Self->Tablets) {
464+
const TSubDomainKey objectDomain = tablet.ObjectDomain;
465+
++tabletsTotal[objectDomain];
466+
467+
const TNodeInfo* node = tablet.GetNode();
468+
if (node) {
469+
if (node->GetServicedDomain() == objectDomain) {
470+
++tabletsRunningInObjectDomain[objectDomain];
471+
} else {
472+
++tabletsRunningInOtherDomains[objectDomain];
473+
}
474+
}
475+
476+
for (const auto& follower : tablet.Followers) {
477+
++tabletsTotal[objectDomain];
478+
479+
const TNodeInfo* followerNode = follower.GetNode();
480+
if (followerNode) {
481+
if (followerNode->GetServicedDomain() == objectDomain) {
482+
++tabletsRunningInObjectDomain[objectDomain];
483+
} else {
484+
++tabletsRunningInOtherDomains[objectDomain];
485+
}
486+
}
487+
}
488+
}
489+
459490
// out << "<script>$('.container').css('width', 'auto');</script>";
460491
out << "<table class='table table-sortable'>";
461492
out << "<thead>";
462-
out << "<tr><th>TenantId</th><th>Name</th><th>Hive</th><th>Status</th></tr>";
493+
out << "<tr>";
494+
out << "<th>TenantId</th>";
495+
out << "<th>Name</th>";
496+
out << "<th>Hive</th>";
497+
out << "<th>Status</th>";
498+
out << "<th>TabletsRunningInTenantDomain</th>";
499+
out << "<th>TabletsRunningInOtherDomains</th>";
500+
out << "<th>TabletsTotal</th>";
501+
out << "</tr>";
463502
out << "</thead>";
464503
out << "<tbody>";
465504
for (const auto& [domainKey, domainInfo] : Self->Domains) {
@@ -482,6 +521,16 @@ class TTxMonEvent_MemStateDomains : public TTransactionBase<THive> {
482521
out << "<td>-</td>";
483522
out << "<td>-</td>";
484523
}
524+
if (tabletsTotal[domainKey] > 0) {
525+
out << "<td>" << std::round(tabletsRunningInObjectDomain[domainKey] * 100.0 / tabletsTotal[domainKey]) << "%"
526+
<< " (" << tabletsRunningInObjectDomain[domainKey] << " of " << tabletsTotal[domainKey] << ")" << "</td>";
527+
out << "<td>" << std::round(tabletsRunningInOtherDomains[domainKey] * 100.0 / tabletsTotal[domainKey]) << "%"
528+
<< " (" << tabletsRunningInOtherDomains[domainKey] << " of " << tabletsTotal[domainKey] << ")" << "</td>";
529+
} else {
530+
out << "<td>-</td>";
531+
out << "<td>-</td>";
532+
}
533+
out << "<td>" << tabletsTotal[domainKey] << "</td>";
485534
out << "</tr>";
486535
}
487536
out << "</tbody>";

0 commit comments

Comments
 (0)