Skip to content

Commit

Permalink
Source/Sink in by Stage DQRUN Aggregated Stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Hor911 committed Nov 30, 2023
1 parent a0a9432 commit 154baef
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ydb/library/yql/providers/dq/provider/yql_dq_provider_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ Y_UNIT_TEST(CollectTaskRunnerStatisticsByStage) {
}
}
};
"Source" = {
"total" = {}
};
"Sink" = {
"total" = {}
};
"Task" = {
"total" = {
"Counter3" = {
Expand Down
22 changes: 21 additions & 1 deletion ydb/library/yql/providers/dq/provider/yql_dq_statistics_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ void CollectTaskRunnerStatisticsByStage(NYson::TYsonWriter& writer, const TOpera
THashMap<TString, TOperationStatistics> taskRunnerStage;
THashMap<TString, TOperationStatistics> taskRunnerInput;
THashMap<TString, TOperationStatistics> taskRunnerOutput;
THashMap<TString, TOperationStatistics> taskRunnerSource;
THashMap<TString, TOperationStatistics> taskRunnerSink;

for (const auto& entry : taskRunner.Entries) {
TString prefix, name;
Expand All @@ -39,6 +41,8 @@ void CollectTaskRunnerStatisticsByStage(NYson::TYsonWriter& writer, const TOpera
}
auto maybeInput = labels.find("Input");
auto maybeOutput = labels.find("Output");
auto maybeSource = labels.find("Source");
auto maybeSink = labels.find("Sink");
auto maybeStage = labels.find("Stage");
if (maybeStage == labels.end()) {
maybeStage = labels.find("Task");
Expand All @@ -55,7 +59,15 @@ void CollectTaskRunnerStatisticsByStage(NYson::TYsonWriter& writer, const TOpera
auto newEntry = entry; newEntry.Name = name;
taskRunnerOutput[maybeStage->second].Entries.push_back(newEntry);
}
if (maybeInput == labels.end() && maybeOutput == labels.end()) {
if (maybeSource != labels.end()) {
auto newEntry = entry; newEntry.Name = name;
taskRunnerSource[maybeStage->second].Entries.push_back(newEntry);
}
if (maybeSink != labels.end()) {
auto newEntry = entry; newEntry.Name = name;
taskRunnerSink[maybeStage->second].Entries.push_back(newEntry);
}
if (maybeInput == labels.end() && maybeOutput == labels.end() && maybeSource == labels.end() && maybeSink == labels.end()) {
auto newEntry = entry; newEntry.Name = name;
taskRunnerStage[maybeStage->second].Entries.push_back(newEntry);
}
Expand All @@ -65,6 +77,8 @@ void CollectTaskRunnerStatisticsByStage(NYson::TYsonWriter& writer, const TOpera
for (const auto& [stageId, stat] : taskRunnerStage) {
const auto& inputStat = taskRunnerInput[stageId];
const auto& outputStat = taskRunnerOutput[stageId];
const auto& sourceStat = taskRunnerSource[stageId];
const auto& sinkStat = taskRunnerSink[stageId];

writer.OnKeyedItem("Stage=" + stageId);
{
Expand All @@ -76,6 +90,12 @@ void CollectTaskRunnerStatisticsByStage(NYson::TYsonWriter& writer, const TOpera
writer.OnKeyedItem("Output");
NCommon::WriteStatistics(writer, totalOnly, {{0, outputStat}});

writer.OnKeyedItem("Source");
NCommon::WriteStatistics(writer, totalOnly, {{0, sourceStat}});

writer.OnKeyedItem("Sink");
NCommon::WriteStatistics(writer, totalOnly, {{0, sinkStat}});

writer.OnKeyedItem("Task");
NCommon::WriteStatistics(writer, totalOnly, {{0, stat}});

Expand Down

0 comments on commit 154baef

Please sign in to comment.