Skip to content

Commit

Permalink
statistics aggregator tablet page (#4006)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexd65536 authored Apr 24, 2024
1 parent 90240d2 commit 3caf512
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions ydb/core/statistics/aggregator/aggregator_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,30 @@ void TStatisticsAggregator::PersistScanStartTime(NIceDb::TNiceDb& db) {
PersistSysParam(db, Schema::SysParam_ScanStartTime, ToString(ScanStartTime.MicroSeconds()));
}

template <typename T, typename S>
void PrintContainerStart(const T& container, size_t count, TStringStream& str,
std::function<S(const typename T::value_type&)> extractor)
{
if (container.empty()) {
return;
}
str << " ";
size_t i = 0;
for (const auto& entry : container) {
if (i) {
str << ", ";
}
str << extractor(entry);
if (++i == count) {
break;
}
}
if (container.size() > count) {
str << " ...";
}
str << Endl;
}

bool TStatisticsAggregator::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev,
const TActorContext& ctx)
{
Expand All @@ -535,6 +559,69 @@ bool TStatisticsAggregator::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev
PRE() {
str << "---- StatisticsAggregator ----" << Endl << Endl;
str << "Database: " << Database << Endl;
str << "BaseStats: " << BaseStats.size() << Endl;
str << "SchemeShards: " << SchemeShards.size() << Endl;
{
std::function<TSSId(const std::pair<const TSSId, size_t>&)> extr =
[](const auto& x) { return x.first; };
PrintContainerStart(SchemeShards, 4, str, extr);
}
str << "Nodes: " << Nodes.size() << Endl;
{
std::function<TNodeId(const std::pair<const TNodeId, size_t>&)> extr =
[](const auto& x) { return x.first; };
PrintContainerStart(Nodes, 8, str, extr);
}
str << "RequestedSchemeShards: " << RequestedSchemeShards.size() << Endl;
{
std::function<TSSId(const TSSId&)> extr = [](const auto& x) { return x; };
PrintContainerStart(RequestedSchemeShards, 4, str, extr);
}
str << "FastCounter: " << FastCounter << Endl;
str << "FastCheckInFlight: " << FastCheckInFlight << Endl;
str << "FastSchemeShards: " << FastSchemeShards.size() << Endl;
{
std::function<TSSId(const TSSId&)> extr = [](const auto& x) { return x; };
PrintContainerStart(FastSchemeShards, 4, str, extr);
}
str << "FastNodes: " << FastNodes.size() << Endl;
{
std::function<TNodeId(const TNodeId&)> extr = [](const auto& x) { return x; };
PrintContainerStart(FastNodes, 8, str, extr);
}
str << "PropagationInFlight: " << PropagationInFlight << Endl;
str << "PropagationSchemeShards: " << PropagationSchemeShards.size() << Endl;
{
std::function<TSSId(const TSSId&)> extr = [](const auto& x) { return x; };
PrintContainerStart(PropagationSchemeShards, 4, str, extr);
}
str << "PropagationNodes: " << PropagationNodes.size() << Endl;
{
std::function<TNodeId(const TNodeId&)> extr = [](const auto& x) { return x; };
PrintContainerStart(FastNodes, 8, str, extr);
}
str << "LastSSIndex: " << LastSSIndex << Endl;
str << "PendingRequests: " << PendingRequests.size() << Endl;
str << "ProcessUrgentInFlight: " << ProcessUrgentInFlight << Endl << Endl;

str << "ScanTableId: " << ScanTableId << Endl;
str << "Columns: " << Columns.size() << Endl;
str << "ShardRanges: " << ShardRanges.size() << Endl;
str << "CountMinSketches: " << CountMinSketches.size() << Endl << Endl;

str << "ScanTablesByTime: " << ScanTablesByTime.size() << Endl;
if (!ScanTablesByTime.empty()) {
auto& scanTable = ScanTablesByTime.top();
str << " top: " << scanTable.PathId
<< ", last update time: " << scanTable.LastUpdateTime << Endl;
}
str << "ScanTablesBySchemeShard: " << ScanTablesBySchemeShard.size() << Endl;
if (!ScanTablesBySchemeShard.empty()) {
str << " " << ScanTablesBySchemeShard.begin()->first << Endl;
std::function<TPathId(const TPathId&)> extr = [](const auto& x) { return x; };
PrintContainerStart(ScanTablesBySchemeShard.begin()->second, 2, str, extr);
}
str << "ScanStartTime: " << ScanStartTime << Endl;
}
}

Expand Down

0 comments on commit 3caf512

Please sign in to comment.