Bring back heavy metrics

This commit is contained in:
Antonio Andelic 2022-11-10 12:56:27 +01:00
parent 89fc3f52f3
commit 94aab4276c
6 changed files with 8 additions and 6 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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
{

View File

@ -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;
};

View File

@ -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)

View File

@ -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;