From 439a5d10e9f1cc6cb132355b91a834b53acd9f7c Mon Sep 17 00:00:00 2001 From: yu yunfeng Date: Wed, 29 May 2019 19:15:32 +0800 Subject: [PATCH] add IO gauge Former-commit-id: f23a858abade383d61780caf146f5dbbf578a113 --- cpp/src/CMakeLists.txt | 1 + cpp/src/db/FaissExecutionEngine.inl | 4 ++-- cpp/src/metrics/MetricBase.h | 1 + cpp/src/metrics/PrometheusMetrics.h | 10 +++++++++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index f91944fa..d1369b5c 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 d69519d0..8dd701d5 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 a857d682..d720b8de 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 06fa64bf..d60c7f48 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") -- GitLab