From 0f28bcc882c7c57b913438cabbaea30ae4bd38f8 Mon Sep 17 00:00:00 2001 From: jimingquan Date: Fri, 24 Jun 2022 15:30:57 +0800 Subject: [PATCH] add stats under index conditions --- src/storage/mutate/AddEdgesProcessor.cpp | 14 +++++++------- src/storage/mutate/AddVerticesProcessor.cpp | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/storage/mutate/AddEdgesProcessor.cpp b/src/storage/mutate/AddEdgesProcessor.cpp index 201d30ceba9..f0d16bd8cfc 100644 --- a/src/storage/mutate/AddEdgesProcessor.cpp +++ b/src/storage/mutate/AddEdgesProcessor.cpp @@ -195,16 +195,16 @@ void AddEdgesProcessor::doProcessWithIndex(const cpp2::AddEdgesRequest& req) { kvs.emplace_back(std::move(key), std::move(encode.value())); } - auto atomicOp = - [partId, data = std::move(kvs), this]() mutable -> kvstore::MergeableAtomicOpResult { - return addEdgesWithIndex(partId, std::move(data)); - }; - - auto cb = [partId, this](nebula::cpp2::ErrorCode ec) { handleAsync(spaceId_, partId, ec); }; - if (code != nebula::cpp2::ErrorCode::SUCCEEDED) { handleAsync(spaceId_, partId, code); } else { + stats::StatsManager::addValue(kNumEdgesInserted, kvs.size()); + auto atomicOp = + [partId, data = std::move(kvs), this]() mutable -> kvstore::MergeableAtomicOpResult { + return addEdgesWithIndex(partId, std::move(data)); + }; + auto cb = [partId, this](nebula::cpp2::ErrorCode ec) { handleAsync(spaceId_, partId, ec); }; + env_->kvstore_->asyncAtomicOp(spaceId_, partId, std::move(atomicOp), std::move(cb)); } } diff --git a/src/storage/mutate/AddVerticesProcessor.cpp b/src/storage/mutate/AddVerticesProcessor.cpp index 2302e6d7ce5..3f598fcad12 100644 --- a/src/storage/mutate/AddVerticesProcessor.cpp +++ b/src/storage/mutate/AddVerticesProcessor.cpp @@ -195,6 +195,7 @@ void AddVerticesProcessor::doProcessWithIndex(const cpp2::AddVerticesRequest& re if (code != nebula::cpp2::ErrorCode::SUCCEEDED) { handleAsync(spaceId_, partId, code); } else { + stats::StatsManager::addValue(kNumVerticesInserted, verticeData.size()); auto atomicOp = [=, tags = std::move(tags), vertices = std::move(verticeData)]() mutable { return addVerticesWithIndex(partId, tags, vertices); };