diff options
author | hor911 <hor911@ydb.tech> | 2022-10-02 22:26:56 +0300 |
---|---|---|
committer | hor911 <hor911@ydb.tech> | 2022-10-02 22:26:56 +0300 |
commit | e310568785b85b8f52ce3c6cb4b99bd4b56ccea3 (patch) | |
tree | a53c8406505c61c16587f40f6cdba602c35a8bf6 | |
parent | a9930bc610039a0f28f6982517496797edcf0985 (diff) | |
download | ydb-e310568785b85b8f52ce3c6cb4b99bd4b56ccea3.tar.gz |
Include precomputes into statistics. Skip empty cluster in RA.
-rw-r--r-- | ydb/core/yq/libs/actors/run_actor.cpp | 17 | ||||
-rw-r--r-- | ydb/library/yql/providers/dq/actors/resource_allocator.cpp | 6 |
2 files changed, 14 insertions, 9 deletions
diff --git a/ydb/core/yq/libs/actors/run_actor.cpp b/ydb/core/yq/libs/actors/run_actor.cpp index d082be85880..e49c8236165 100644 --- a/ydb/core/yq/libs/actors/run_actor.cpp +++ b/ydb/core/yq/libs/actors/run_actor.cpp @@ -936,17 +936,16 @@ private: return out.Str(); } - void SaveStatistics(const NYql::NDqProto::TQueryResponse& result) { + void SaveStatistics(const TString& graphKey, const NYql::NDqProto::TQueryResponse& result) { // Yson routines are very strict, so it's better to try-catch them try { - Statistics.push_back(BuildNormalizedStatistics(result)); + Statistics.emplace_back(graphKey, BuildNormalizedStatistics(result)); TStringStream out; NYson::TYsonWriter writer(&out); writer.OnBeginMap(); - ui32 graphIndex = 0; - for (const auto& s : Statistics) { - writer.OnKeyedItem("Graph=" + ToString(++graphIndex)); - writer.OnRaw(s); + for (const auto& p : Statistics) { + writer.OnKeyedItem(p.first); + writer.OnRaw(p.second); } writer.OnEndMap(); QueryStateUpdateRequest.set_statistics(NJson2Yson::ConvertYson2Json(out.Str())); @@ -983,7 +982,7 @@ private: QueryStateUpdateRequest.mutable_result_id()->set_value(Params.ResultId); - SaveStatistics(result); + SaveStatistics("Graph=" + ToString(DqGraphIndex), result); KillExecuter(); } @@ -1014,6 +1013,8 @@ private: QueryResult.SetSuccess(); } + SaveStatistics("Precompute=", result); + QueryResult.AddIssues(issues); QueryResult.Truncated = result.GetTruncated(); QueryResult.RowsCount = result.GetRowsCount(); @@ -1962,7 +1963,7 @@ private: // Consumers creation TVector<NYql::NPq::NProto::TDqPqTopicSource> TopicsForConsumersCreation; TVector<std::shared_ptr<NYdb::ICredentialsProviderFactory>> CredentialsForConsumersCreation; - TVector<TString> Statistics; + TVector<std::pair<TString, TString>> Statistics; NActors::TActorId ReadRulesCreatorId; // Rate limiter resource creation diff --git a/ydb/library/yql/providers/dq/actors/resource_allocator.cpp b/ydb/library/yql/providers/dq/actors/resource_allocator.cpp index 227e67afad0..b6011d22e21 100644 --- a/ydb/library/yql/providers/dq/actors/resource_allocator.cpp +++ b/ydb/library/yql/providers/dq/actors/resource_allocator.cpp @@ -184,7 +184,11 @@ private: requestedNode.RequestedFlag = true; auto delta = TInstant::Now() - requestedNode.StartTime; // catched and grpc_service - QueryStat.AddCounter(QueryStat.GetCounterName("Actor", {{"ClusterName", requestedNode.ClusterName}}, "ActorCreateTime"), delta); + std::map<TString, TString> labels; + if (requestedNode.ClusterName) { + labels.emplace("ClusterName", requestedNode.ClusterName); + } + QueryStat.AddCounter(QueryStat.GetCounterName("Actor", labels, "ActorCreateTime"), delta); } if (AllocatedCount == RequestedCount) { |