mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 12:32:04 +00:00
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <Common/AsynchronousMetrics.h>
|
|
#include <Interpreters/Context_fwd.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class ServerAsynchronousMetrics : WithContext, public AsynchronousMetrics
|
|
{
|
|
public:
|
|
ServerAsynchronousMetrics(
|
|
ContextPtr global_context_,
|
|
unsigned update_period_seconds,
|
|
unsigned heavy_metrics_update_period_seconds,
|
|
const ProtocolServerMetricsFunc & protocol_server_metrics_func_);
|
|
~ServerAsynchronousMetrics() override;
|
|
|
|
private:
|
|
void updateImpl(TimePoint update_time, TimePoint current_time, bool force_update, bool first_run, AsynchronousMetricValues & new_values) override;
|
|
void logImpl(AsynchronousMetricValues & new_values) override;
|
|
|
|
const Duration heavy_metric_update_period;
|
|
TimePoint heavy_metric_previous_update_time;
|
|
double heavy_update_interval = 0.;
|
|
|
|
struct DetachedPartsStats
|
|
{
|
|
size_t count;
|
|
size_t detached_by_user;
|
|
};
|
|
|
|
DetachedPartsStats detached_parts_stats{};
|
|
|
|
void updateDetachedPartsStats();
|
|
void updateHeavyMetricsIfNeeded(TimePoint current_time, TimePoint update_time, bool force_update, bool first_run, AsynchronousMetricValues & new_values);
|
|
};
|
|
|
|
}
|