diff options
author | Tor Egge <Tor.Egge@online.no> | 2021-12-02 11:05:53 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2021-12-02 11:05:53 +0100 |
commit | b38951d635f0bfbb2035a3242310c2f0a74423cf (patch) | |
tree | 57d8476a6e915659076f4b0ca3375d53729ffea6 /storage | |
parent | d170b0473c80ebd0f4cc44a411feba1c4f4edefd (diff) |
Change update_active_operations_metrics to a private member function.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp | 14 | ||||
-rw-r--r-- | storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp index 78d4dffd40e..f76d2693309 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.cpp @@ -297,11 +297,12 @@ FileStorHandlerImpl::abortQueuedOperations(const AbortBucketOperationsCommand& c } } -namespace { - void -update_active_operations_metrics(ActiveOperationsMetrics& metrics, ActiveOperationsStats stats, std::optional<ActiveOperationsStats>& last_stats) +FileStorHandlerImpl::update_active_operations_metrics() { + auto& metrics = _metrics->active_operations; + auto stats = get_active_operations_stats(true); + auto& last_stats = _last_active_operations_stats; auto delta_stats = stats; if (last_stats.has_value()) { delta_stats -= last_stats.value(); @@ -323,8 +324,6 @@ update_active_operations_metrics(ActiveOperationsMetrics& metrics, ActiveOperati } } -} - void FileStorHandlerImpl::updateMetrics(const MetricLockGuard &) { @@ -336,8 +335,7 @@ FileStorHandlerImpl::updateMetrics(const MetricLockGuard &) const auto & m = stripe->averageQueueWaitingTime; _metrics->averageQueueWaitingTime.addTotalValueWithCount(m.getTotal(), m.getCount()); } - auto active_operations_stats = get_active_operations_stats(true); - update_active_operations_metrics(_metrics->active_operations, active_operations_stats, _last_active_operations_stats); + update_active_operations_metrics(); } bool @@ -1145,7 +1143,7 @@ FileStorHandlerImpl::Stripe::operationIsInhibited(const monitor_guard & guard, c ActiveOperationsStats FileStorHandlerImpl::Stripe::get_active_operations_stats(bool reset_min_max) const { - std::lock_guard<std::mutex> guard(*_lock); + std::lock_guard guard(*_lock); auto result = _active_operations_stats; if (reset_min_max) { _active_operations_stats.reset_min_max(); diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h index 5f0bc2d9939..3a89ff74f07 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h @@ -284,6 +284,8 @@ private: static std::unique_ptr<api::StorageReply> makeQueueTimeoutReply(api::StorageMessage& msg); static bool messageMayBeAborted(const api::StorageMessage& msg); + void update_active_operations_metrics(); + // Implements framework::MetricUpdateHook void updateMetrics(const MetricLockGuard &) override; |