提交 f2e58515 编写于 作者: Y Yu Kun

modify CollectorMetrics in InsertVectors


Former-commit-id: e00d68ca1be8407061f3ac6b9fc41fa36fe24b13
上级 b83f7103
......@@ -141,9 +141,9 @@ Status DBImpl::InsertVectors(const std::string& table_id_,
uint64_t n, const float* vectors, IDNumbers& vector_ids_) {
ENGINE_LOG_DEBUG << "Insert " << n << " vectors to cache";
auto start_time = METRICS_NOW_TIME;
Status status = mem_mgr_->InsertVectors(table_id_, n, vectors, vector_ids_);
zilliz::milvus::server::CollectInsertMetrics metrics(start_time, n, status.ok());
Status status;
zilliz::milvus::server::CollectInsertMetrics metrics(n, status);
status = mem_mgr_->InsertVectors(table_id_, n, vectors, vector_ids_);
// std::chrono::microseconds time_span = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
// double average_time = double(time_span.count()) / n;
......
......@@ -32,8 +32,8 @@ class Metrics {
class CollectInsertMetrics {
public:
CollectInsertMetrics(std::chrono::system_clock::time_point start_time,
size_t n, bool succeed) : start_time_(start_time), n_(n), succeed_(succeed) {
CollectInsertMetrics(size_t n, engine::Status& status) : n_(n), status_(status) {
start_time_ = METRICS_NOW_TIME;
}
~CollectInsertMetrics() {
......@@ -45,7 +45,7 @@ public:
}
// server::Metrics::GetInstance().add_vector_duration_seconds_quantiles().Observe((average_time));
if (succeed_) {
if (status_.ok()) {
server::Metrics::GetInstance().AddVectorsSuccessTotalIncrement(n_);
server::Metrics::GetInstance().AddVectorsSuccessGaugeSet(n_);
}
......@@ -59,7 +59,7 @@ private:
using TIME_POINT = std::chrono::system_clock::time_point;
TIME_POINT start_time_;
size_t n_;
bool succeed_;
engine::Status& status_;
};
class CollectQueryMetrics {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册