-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
70 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ nebula_add_library( | |
ParserUtil.cpp | ||
PlannerUtil.cpp | ||
ValidateUtil.cpp | ||
Utils.cpp | ||
) | ||
|
||
nebula_add_library( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) 2022 vesoft inc. All rights reserved. | ||
// | ||
// This source code is licensed under Apache 2.0 License. | ||
|
||
#include "graph/util/Utils.h" | ||
|
||
#include "interface/gen-cpp2/storage_types.h" | ||
|
||
namespace nebula::graph::util { | ||
|
||
folly::dynamic getStorageDetail(const std::map<std::string, int32_t>& profileDetail) { | ||
folly::dynamic profileData = folly::dynamic::object(); | ||
for (auto& p : profileDetail) { | ||
profileData.insert(p.first, folly::sformat("{}(us)", p.second)); | ||
} | ||
return profileData; | ||
} | ||
|
||
folly::dynamic collectRespProfileData(const storage::cpp2::ResponseCommon& resp, | ||
const std::tuple<HostAddr, int32_t, int32_t>& info, | ||
size_t numVertices, | ||
size_t totalRpcTime) { | ||
folly::dynamic stat = folly::dynamic::object(); | ||
stat.insert("address", std::get<0>(info).toString()); | ||
stat.insert("exec", folly::sformat("{}(us)", std::get<1>(info))); | ||
stat.insert("total", folly::sformat("{}(us)", std::get<2>(info))); | ||
if (numVertices > 0) { | ||
stat.insert("vertices", numVertices); | ||
} | ||
if (totalRpcTime > 0) { | ||
stat.insert("total_rpc_time", folly::sformat("{}(us)", totalRpcTime)); | ||
} | ||
if (resp.latency_detail_us_ref().has_value()) { | ||
stat.insert("storage_detail", getStorageDetail(*resp.get_latency_detail_us())); | ||
} | ||
return stat; | ||
} | ||
|
||
} // namespace nebula::graph::util |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters