diff options
author | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-04-06 17:14:39 +0300 |
---|---|---|
committer | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-04-06 17:14:39 +0300 |
commit | b7fb26af374a357928e8fe8fe1e9f9a7bb778b0b (patch) | |
tree | 35d398a62c5ea920ea4b38ae30defb8df326c4b4 | |
parent | 153e41f932288c0b73738149d140e6caa5e610cb (diff) | |
download | ydb-b7fb26af374a357928e8fe8fe1e9f9a7bb778b0b.tar.gz |
task start instant for stats profile (in diagram usage)
-rw-r--r-- | ydb/core/kqp/opt/kqp_query_plan.cpp | 1 | ||||
-rw-r--r-- | ydb/library/yql/dq/actors/compute/dq_compute_actor_stats.cpp | 1 | ||||
-rw-r--r-- | ydb/library/yql/dq/actors/protos/dq_stats.proto | 1 | ||||
-rw-r--r-- | ydb/library/yql/dq/runtime/dq_tasks_runner.cpp | 1 | ||||
-rw-r--r-- | ydb/library/yql/dq/runtime/dq_tasks_runner.h | 4 |
5 files changed, 6 insertions, 2 deletions
diff --git a/ydb/core/kqp/opt/kqp_query_plan.cpp b/ydb/core/kqp/opt/kqp_query_plan.cpp index 33447c05f7..17fa8edfd9 100644 --- a/ydb/core/kqp/opt/kqp_query_plan.cpp +++ b/ydb/core/kqp/opt/kqp_query_plan.cpp @@ -1663,6 +1663,7 @@ TString AddExecStatsToTxPlan(const TString& txPlanJson, const NYql::NDqProto::TD SetNonZero(node, "FirstRowTimeMs", taskStats.GetFirstRowTimeMs()); SetNonZero(node, "FinishTimeMs", taskStats.GetFinishTimeMs()); + SetNonZero(node, "StartTimeMs", taskStats.GetStartTimeMs()); SetNonZero(node, "ComputeTimeUs", taskStats.GetComputeCpuTimeUs()); SetNonZero(node, "WaitTimeUs", taskStats.GetWaitTimeUs()); diff --git a/ydb/library/yql/dq/actors/compute/dq_compute_actor_stats.cpp b/ydb/library/yql/dq/actors/compute/dq_compute_actor_stats.cpp index 1666424ec3..d6fd13f729 100644 --- a/ydb/library/yql/dq/actors/compute/dq_compute_actor_stats.cpp +++ b/ydb/library/yql/dq/actors/compute/dq_compute_actor_stats.cpp @@ -13,6 +13,7 @@ void FillTaskRunnerStats(ui64 taskId, ui32 stageId, const TTaskRunnerStatsBase& protoTask->SetStageId(stageId); protoTask->SetCpuTimeUs(taskStats.ComputeCpuTime.MicroSeconds() + taskStats.BuildCpuTime.MicroSeconds()); protoTask->SetFinishTimeMs(taskStats.FinishTs.MilliSeconds()); + protoTask->SetStartTimeMs(taskStats.StartTs.MilliSeconds()); // Cerr << (TStringBuilder() << "FillTaskRunnerStats: " << taskStats.ComputeCpuTime << ", " << taskStats.BuildCpuTime << Endl); if (Y_UNLIKELY(withProfileStats)) { diff --git a/ydb/library/yql/dq/actors/protos/dq_stats.proto b/ydb/library/yql/dq/actors/protos/dq_stats.proto index f3f5f7ce86..d0fb6acc11 100644 --- a/ydb/library/yql/dq/actors/protos/dq_stats.proto +++ b/ydb/library/yql/dq/actors/protos/dq_stats.proto @@ -158,6 +158,7 @@ message TDqTaskStats { repeated TDqAsyncInputBufferStats InputTransforms = 155; string HostName = 156; uint32 NodeId = 157; + uint64 StartTimeMs = 158; google.protobuf.Any Extra = 200; } diff --git a/ydb/library/yql/dq/runtime/dq_tasks_runner.cpp b/ydb/library/yql/dq/runtime/dq_tasks_runner.cpp index 8b20a0469a..ac9f9040b2 100644 --- a/ydb/library/yql/dq/runtime/dq_tasks_runner.cpp +++ b/ydb/library/yql/dq/runtime/dq_tasks_runner.cpp @@ -234,6 +234,7 @@ public: { if (CollectBasicStats) { Stats = std::make_unique<TDqTaskRunnerStats>(); + Stats->StartTs = TInstant::Now(); if (Y_UNLIKELY(CollectProfileStats)) { Stats->ComputeCpuTimeByRun = NMonitoring::ExponentialHistogram(6, 10, 10); } diff --git a/ydb/library/yql/dq/runtime/dq_tasks_runner.h b/ydb/library/yql/dq/runtime/dq_tasks_runner.h index 9ce0bf5662..713b5d3c60 100644 --- a/ydb/library/yql/dq/runtime/dq_tasks_runner.h +++ b/ydb/library/yql/dq/runtime/dq_tasks_runner.h @@ -73,6 +73,7 @@ struct TTaskRunnerStatsBase { // basic stats TDuration BuildCpuTime; TInstant FinishTs; + TInstant StartTs; TDuration ComputeCpuTime; TRunStatusTimeMetrics RunStatusTimeMetrics; // ComputeCpuTime + RunStatusTimeMetrics == 100% time @@ -98,8 +99,6 @@ struct TTaskRunnerStatsBase { template<typename T> void FromProto(const T& f) { - //s->StartTs = TInstant::MilliSeconds(f.GetStartTs()); - //s->FinishTs = TInstant::MilliSeconds(f.GetFinishTs()); this->BuildCpuTime = TDuration::MicroSeconds(f.GetBuildCpuTimeUs()); this->ComputeCpuTime = TDuration::MicroSeconds(f.GetComputeCpuTimeUs()); this->RunStatusTimeMetrics.Load(ERunStatus::PendingInput, TDuration::MicroSeconds(f.GetPendingInputTimeUs())); @@ -339,6 +338,7 @@ template <> inline void Out<NYql::NDq::TTaskRunnerStatsBase>(IOutputStream& os, TTypeTraits<NYql::NDq::TTaskRunnerStatsBase>::TFuncParam stats) { os << "TTaskRunnerStatsBase:" << Endl << "\tBuildCpuTime: " << stats.BuildCpuTime << Endl + << "\tStartTs: " << stats.StartTs << Endl << "\tFinishTs: " << stats.FinishTs << Endl << "\tComputeCpuTime: " << stats.ComputeCpuTime << Endl << "\tWaitTime: " << stats.WaitTime << Endl |