Skip to content

Commit

Permalink
Collect longest times per stage
Browse files Browse the repository at this point in the history
  • Loading branch information
Hor911 committed Feb 20, 2025
1 parent 1a9a4ad commit a3fb228
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions ydb/core/kqp/executer_actor/kqp_executer_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,10 +837,11 @@ void TQueryExecutionStats::AddComputeActorStats(ui32 /* nodeId */, NYql::NDqProt
// enough to result in an enormous duration - triggering the "long tasks" mode.

auto taskDuration = TDuration::MilliSeconds(task.GetFinishTimeMs() - task.GetStartTimeMs());
if (taskDuration > Max(collectLongTaskStatsTimeout, LongestTaskDuration)) {
auto& longestTaskDuration = LongestTaskDurations[task.GetStageId()];
if (taskDuration > Max(collectLongTaskStatsTimeout, longestTaskDuration)) {
CollectStatsByLongTasks = true;
longTask = &task;
LongestTaskDuration = taskDuration;
longestTaskDuration = taskDuration;
}
}

Expand Down Expand Up @@ -982,10 +983,11 @@ void TQueryExecutionStats::AddDatashardStats(NYql::NDqProto::TDqComputeActorStat
// checking whether the task is long

auto taskDuration = TDuration::MilliSeconds(task.GetFinishTimeMs() - task.GetStartTimeMs());
if (taskDuration > Max(collectLongTaskStatsTimeout, LongestTaskDuration)) {
auto& longestTaskDuration = LongestTaskDurations[task.GetStageId()];
if (taskDuration > Max(collectLongTaskStatsTimeout, longestTaskDuration)) {
CollectStatsByLongTasks = true;
longTask = &task;
LongestTaskDuration = taskDuration;
longestTaskDuration = taskDuration;
}
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/kqp/executer_actor/kqp_executer_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ struct TQueryExecutionStats {
std::map<ui32, TStageExecutionStats> StageStats;
std::map<ui32, TIngressExternalPartitionStat> ExternalPartitionStats; // FIXME: several ingresses
ui64 BaseTimeMs = 0;
TDuration LongestTaskDuration;
std::map<ui32, TDuration> LongestTaskDurations;
void ExportAggAsyncStats(TAsyncStats& data, NYql::NDqProto::TDqAsyncStatsAggr& stats);
void ExportAggAsyncBufferStats(TAsyncBufferStats& data, NYql::NDqProto::TDqAsyncBufferStatsAggr& stats);
void AdjustExternalAggr(NYql::NDqProto::TDqExternalAggrStats& stats);
Expand Down

0 comments on commit a3fb228

Please sign in to comment.