Skip to content

Commit 3caf512

Browse files
authored
statistics aggregator tablet page (#4006)
1 parent 90240d2 commit 3caf512

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

ydb/core/statistics/aggregator/aggregator_impl.cpp

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,30 @@ void TStatisticsAggregator::PersistScanStartTime(NIceDb::TNiceDb& db) {
523523
PersistSysParam(db, Schema::SysParam_ScanStartTime, ToString(ScanStartTime.MicroSeconds()));
524524
}
525525

526+
template <typename T, typename S>
527+
void PrintContainerStart(const T& container, size_t count, TStringStream& str,
528+
std::function<S(const typename T::value_type&)> extractor)
529+
{
530+
if (container.empty()) {
531+
return;
532+
}
533+
str << " ";
534+
size_t i = 0;
535+
for (const auto& entry : container) {
536+
if (i) {
537+
str << ", ";
538+
}
539+
str << extractor(entry);
540+
if (++i == count) {
541+
break;
542+
}
543+
}
544+
if (container.size() > count) {
545+
str << " ...";
546+
}
547+
str << Endl;
548+
}
549+
526550
bool TStatisticsAggregator::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev,
527551
const TActorContext& ctx)
528552
{
@@ -535,6 +559,69 @@ bool TStatisticsAggregator::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev
535559
PRE() {
536560
str << "---- StatisticsAggregator ----" << Endl << Endl;
537561
str << "Database: " << Database << Endl;
562+
str << "BaseStats: " << BaseStats.size() << Endl;
563+
str << "SchemeShards: " << SchemeShards.size() << Endl;
564+
{
565+
std::function<TSSId(const std::pair<const TSSId, size_t>&)> extr =
566+
[](const auto& x) { return x.first; };
567+
PrintContainerStart(SchemeShards, 4, str, extr);
568+
}
569+
str << "Nodes: " << Nodes.size() << Endl;
570+
{
571+
std::function<TNodeId(const std::pair<const TNodeId, size_t>&)> extr =
572+
[](const auto& x) { return x.first; };
573+
PrintContainerStart(Nodes, 8, str, extr);
574+
}
575+
str << "RequestedSchemeShards: " << RequestedSchemeShards.size() << Endl;
576+
{
577+
std::function<TSSId(const TSSId&)> extr = [](const auto& x) { return x; };
578+
PrintContainerStart(RequestedSchemeShards, 4, str, extr);
579+
}
580+
str << "FastCounter: " << FastCounter << Endl;
581+
str << "FastCheckInFlight: " << FastCheckInFlight << Endl;
582+
str << "FastSchemeShards: " << FastSchemeShards.size() << Endl;
583+
{
584+
std::function<TSSId(const TSSId&)> extr = [](const auto& x) { return x; };
585+
PrintContainerStart(FastSchemeShards, 4, str, extr);
586+
}
587+
str << "FastNodes: " << FastNodes.size() << Endl;
588+
{
589+
std::function<TNodeId(const TNodeId&)> extr = [](const auto& x) { return x; };
590+
PrintContainerStart(FastNodes, 8, str, extr);
591+
}
592+
str << "PropagationInFlight: " << PropagationInFlight << Endl;
593+
str << "PropagationSchemeShards: " << PropagationSchemeShards.size() << Endl;
594+
{
595+
std::function<TSSId(const TSSId&)> extr = [](const auto& x) { return x; };
596+
PrintContainerStart(PropagationSchemeShards, 4, str, extr);
597+
}
598+
str << "PropagationNodes: " << PropagationNodes.size() << Endl;
599+
{
600+
std::function<TNodeId(const TNodeId&)> extr = [](const auto& x) { return x; };
601+
PrintContainerStart(FastNodes, 8, str, extr);
602+
}
603+
str << "LastSSIndex: " << LastSSIndex << Endl;
604+
str << "PendingRequests: " << PendingRequests.size() << Endl;
605+
str << "ProcessUrgentInFlight: " << ProcessUrgentInFlight << Endl << Endl;
606+
607+
str << "ScanTableId: " << ScanTableId << Endl;
608+
str << "Columns: " << Columns.size() << Endl;
609+
str << "ShardRanges: " << ShardRanges.size() << Endl;
610+
str << "CountMinSketches: " << CountMinSketches.size() << Endl << Endl;
611+
612+
str << "ScanTablesByTime: " << ScanTablesByTime.size() << Endl;
613+
if (!ScanTablesByTime.empty()) {
614+
auto& scanTable = ScanTablesByTime.top();
615+
str << " top: " << scanTable.PathId
616+
<< ", last update time: " << scanTable.LastUpdateTime << Endl;
617+
}
618+
str << "ScanTablesBySchemeShard: " << ScanTablesBySchemeShard.size() << Endl;
619+
if (!ScanTablesBySchemeShard.empty()) {
620+
str << " " << ScanTablesBySchemeShard.begin()->first << Endl;
621+
std::function<TPathId(const TPathId&)> extr = [](const auto& x) { return x; };
622+
PrintContainerStart(ScanTablesBySchemeShard.begin()->second, 2, str, extr);
623+
}
624+
str << "ScanStartTime: " << ScanStartTime << Endl;
538625
}
539626
}
540627

0 commit comments

Comments
 (0)