From 94aab4276c72dd62fa1b99d80bacdbfa6fe85f37 Mon Sep 17 00:00:00 2001 From: Antonio Andelic Date: Thu, 10 Nov 2022 12:56:27 +0100 Subject: [PATCH] Bring back heavy metrics --- src/Common/AsynchronousMetrics.cpp | 2 +- src/Common/AsynchronousMetrics.h | 2 +- src/Coordination/KeeperAsynchronousMetrics.cpp | 2 +- src/Coordination/KeeperAsynchronousMetrics.h | 2 +- src/Interpreters/ServerAsynchronousMetrics.cpp | 4 +++- src/Interpreters/ServerAsynchronousMetrics.h | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Common/AsynchronousMetrics.cpp b/src/Common/AsynchronousMetrics.cpp index e775b3aa263..05143cbc666 100644 --- a/src/Common/AsynchronousMetrics.cpp +++ b/src/Common/AsynchronousMetrics.cpp @@ -1265,7 +1265,7 @@ void AsynchronousMetrics::update(TimePoint update_time) /// Add more metrics as you wish. - updateImpl(new_values); + updateImpl(new_values, update_time, current_time); new_values["AsynchronousMetricsCalculationTimeSpent"] = watch.elapsedSeconds(); diff --git a/src/Common/AsynchronousMetrics.h b/src/Common/AsynchronousMetrics.h index 37ee3389da6..3f0eab61304 100644 --- a/src/Common/AsynchronousMetrics.h +++ b/src/Common/AsynchronousMetrics.h @@ -73,7 +73,7 @@ protected: Poco::Logger * log; private: - virtual void updateImpl(AsynchronousMetricValues & new_values) = 0; + virtual void updateImpl(AsynchronousMetricValues & new_values, TimePoint update_time, TimePoint current_time) = 0; virtual void logImpl(AsynchronousMetricValues &) {} ProtocolServerMetricsFunc protocol_server_metrics_func; diff --git a/src/Coordination/KeeperAsynchronousMetrics.cpp b/src/Coordination/KeeperAsynchronousMetrics.cpp index e26f9e1c9e8..4efb90a7995 100644 --- a/src/Coordination/KeeperAsynchronousMetrics.cpp +++ b/src/Coordination/KeeperAsynchronousMetrics.cpp @@ -113,7 +113,7 @@ KeeperAsynchronousMetrics::KeeperAsynchronousMetrics( { } -void KeeperAsynchronousMetrics::updateImpl(AsynchronousMetricValues & new_values) +void KeeperAsynchronousMetrics::updateImpl(AsynchronousMetricValues & new_values, TimePoint /*update_time*/, TimePoint /*current_time*/) { #if USE_NURAFT { diff --git a/src/Coordination/KeeperAsynchronousMetrics.h b/src/Coordination/KeeperAsynchronousMetrics.h index 579131c25b4..5b703951065 100644 --- a/src/Coordination/KeeperAsynchronousMetrics.h +++ b/src/Coordination/KeeperAsynchronousMetrics.h @@ -18,7 +18,7 @@ public: private: const TinyContext & tiny_context; - void updateImpl(AsynchronousMetricValues & new_values) override; + void updateImpl(AsynchronousMetricValues & new_values, TimePoint update_time, TimePoint current_time) override; }; diff --git a/src/Interpreters/ServerAsynchronousMetrics.cpp b/src/Interpreters/ServerAsynchronousMetrics.cpp index ecb2c44d844..cc8fd7e14b2 100644 --- a/src/Interpreters/ServerAsynchronousMetrics.cpp +++ b/src/Interpreters/ServerAsynchronousMetrics.cpp @@ -54,7 +54,7 @@ ServerAsynchronousMetrics::ServerAsynchronousMetrics( , heavy_metric_update_period(heavy_metrics_update_period_seconds) {} -void ServerAsynchronousMetrics::updateImpl(AsynchronousMetricValues & new_values) +void ServerAsynchronousMetrics::updateImpl(AsynchronousMetricValues & new_values, TimePoint update_time, TimePoint current_time) { if (auto mark_cache = getContext()->getMarkCache()) { @@ -268,6 +268,8 @@ void ServerAsynchronousMetrics::updateImpl(AsynchronousMetricValues & new_values updateKeeperInformation(*keeper_dispatcher, new_values); } #endif + + updateHeavyMetricsIfNeeded(current_time, update_time, new_values); } void ServerAsynchronousMetrics::logImpl(AsynchronousMetricValues & new_values) diff --git a/src/Interpreters/ServerAsynchronousMetrics.h b/src/Interpreters/ServerAsynchronousMetrics.h index cd19483032a..81047e2fdf9 100644 --- a/src/Interpreters/ServerAsynchronousMetrics.h +++ b/src/Interpreters/ServerAsynchronousMetrics.h @@ -16,7 +16,7 @@ public: int heavy_metrics_update_period_seconds, const ProtocolServerMetricsFunc & protocol_server_metrics_func_); private: - void updateImpl(AsynchronousMetricValues & new_values) override; + void updateImpl(AsynchronousMetricValues & new_values, TimePoint update_time, TimePoint current_time) override; void logImpl(AsynchronousMetricValues & new_values) override; const Duration heavy_metric_update_period;