diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index f91944fae49eefcdd33ac13a0375f41cdc285007..d1369b5c0ce6c712cc13823bf9c91161201422c0 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -143,6 +143,7 @@ set(server_libs libzstd.a liblz4.a dl + metrics ) if (ENABLE_LICENSE STREQUAL "ON") diff --git a/cpp/src/db/FaissExecutionEngine.inl b/cpp/src/db/FaissExecutionEngine.inl index d69519d0ca735c94cf0a2da9f1b03f7e3aac16db..8dd701d54df474333197b17da3201e1b5736e143 100644 --- a/cpp/src/db/FaissExecutionEngine.inl +++ b/cpp/src/db/FaissExecutionEngine.inl @@ -84,8 +84,8 @@ Status FaissExecutionEngine::Load() { server::Metrics::GetInstance().FaissDiskLoadSizeBytesHistogramObserve(total_size); - server::Metrics::GetInstance().FaissDiskLoadIOSpeedHistogramObserve(total_size/double(total_time)); - +// server::Metrics::GetInstance().FaissDiskLoadIOSpeedHistogramObserve(total_size/double(total_time)); + server::Metrics::GetInstance().FaissDiskLoadIOSpeedGaugeSet(total_size/double(total_time)); } return Status::OK(); } diff --git a/cpp/src/metrics/MetricBase.h b/cpp/src/metrics/MetricBase.h index a857d6827ea0ab01048d8f56f501179e8a2c4af6..d720b8de44e3b3257d239ae9da5d053083343a7a 100644 --- a/cpp/src/metrics/MetricBase.h +++ b/cpp/src/metrics/MetricBase.h @@ -63,6 +63,7 @@ class MetricsBase{ virtual void RawFileSizeTotalIncrement(double value = 1) {}; virtual void IndexFileSizeGaugeSet(double value) {}; virtual void RawFileSizeGaugeSet(double value) {}; + virtual void FaissDiskLoadIOSpeedGaugeSet(double value) {}; }; diff --git a/cpp/src/metrics/PrometheusMetrics.h b/cpp/src/metrics/PrometheusMetrics.h index 06fa64bfa41e4c68f69c8dc629551aa23af26838..d60c7f48401cfe59e69e2758467a12ad9765f141 100644 --- a/cpp/src/metrics/PrometheusMetrics.h +++ b/cpp/src/metrics/PrometheusMetrics.h @@ -87,6 +87,7 @@ class PrometheusMetrics: public MetricsBase { void FaissDiskLoadDurationSecondsHistogramObserve(double value) { if(startup_) faiss_disk_load_duration_seconds_histogram_.Observe(value);}; void FaissDiskLoadSizeBytesHistogramObserve(double value) { if(startup_) faiss_disk_load_size_bytes_histogram_.Observe(value);}; void FaissDiskLoadIOSpeedHistogramObserve(double value) { if(startup_) faiss_disk_load_IO_speed_histogram_.Observe(value);}; + void FaissDiskLoadIOSpeedGaugeSet(double value) { if(startup_) faiss_disk_load_IO_speed_gauge_.Set(value);}; void CacheAccessTotalIncrement(double value = 1) { if(startup_) cache_access_total_.Increment(value);}; void MemTableMergeDurationSecondsHistogramObserve(double value) { if(startup_) mem_table_merge_duration_seconds_histogram_.Observe(value);}; @@ -370,7 +371,14 @@ class PrometheusMetrics: public MetricsBase { .Register(*registry_); prometheus::Histogram &faiss_disk_load_IO_speed_histogram_ = disk_load_IO_speed_.Add({{"DB","Faiss"}},BucketBoundaries{0.1, 1.0, 10.0}); - ////all from CacheMgr.cpp + prometheus::Family &faiss_disk_load_IO_speed_ = prometheus::BuildGauge() + .Name("disk_load_IO_speed_byte_per_sec") + .Help("disk IO speed ") + .Register(*registry_); + prometheus::Gauge &faiss_disk_load_IO_speed_gauge_ = faiss_disk_load_IO_speed_.Add({{"DB","Faiss"}}); + + + ////all from CacheMgr.cpp //record cache access count prometheus::Family &cache_access_ = prometheus::BuildCounter() .Name("cache_access_total")