mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
The correct, safe broad rebrand: renames "ClickHouse" only as a whole word (boundary on BOTH sides), so it rewrites display strings/messages/comments but leaves every compound C++ symbol intact — `ClickHouseDictionarySource`, `getInfoIfClickHouseDictionarySource`, `mainEntryClickHouseServer`, `ClickHouseRevision`, `ClickHouse_SOURCE_DIR` are untouched (an earlier one-sided heuristic mangled suffix symbols like `manageClickHouse`; reverted). 1677 occurrences across 482 files. Compile-safe (string/comment content; symbols preserved). Still NOT renamed (would be a build-coupled symbol rename, needs build-host iteration): the 199 compound identifiers containing ClickHouse, the `DB::` namespace, the `clickhouse_*` CMake targets/macros, the lowercase `clickhouse` SQL dictionary-source keyword. Needs build verification.
66 lines
1.6 KiB
C++
66 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <condition_variable>
|
|
#include <mutex>
|
|
#include <string>
|
|
#include <thread>
|
|
#include <vector>
|
|
#include <optional>
|
|
#include <Core/Types.h>
|
|
#include <Common/ThreadPool.h>
|
|
#include <Common/ProfileEvents.h>
|
|
|
|
|
|
namespace Poco
|
|
{
|
|
namespace Util
|
|
{
|
|
class AbstractConfiguration;
|
|
}
|
|
}
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class AsynchronousMetrics;
|
|
|
|
|
|
/** Automatically sends
|
|
* - delta values of ProfileEvents;
|
|
* - cumulative values of ProfileEvents;
|
|
* - values of CurrentMetrics;
|
|
* - values of AsynchronousMetrics;
|
|
* to Graphite at beginning of every minute.
|
|
*/
|
|
class MetricsTransmitter
|
|
{
|
|
public:
|
|
MetricsTransmitter(const Poco::Util::AbstractConfiguration & config, const std::string & config_name_, const AsynchronousMetrics & async_metrics_);
|
|
~MetricsTransmitter();
|
|
|
|
private:
|
|
void run();
|
|
void transmit(std::vector<ProfileEvents::Count> & prev_counters);
|
|
|
|
const AsynchronousMetrics & async_metrics;
|
|
|
|
std::string config_name;
|
|
UInt32 interval_seconds;
|
|
bool send_events;
|
|
bool send_events_cumulative;
|
|
bool send_metrics;
|
|
bool send_asynchronous_metrics;
|
|
|
|
bool quit = false;
|
|
std::mutex mutex;
|
|
std::condition_variable cond;
|
|
std::optional<ThreadFromGlobalPool> thread;
|
|
|
|
static constexpr auto profile_events_path_prefix = "Datastore.ProfileEvents.";
|
|
static constexpr auto profile_events_cumulative_path_prefix = "Datastore.ProfileEventsCumulative.";
|
|
static constexpr auto current_metrics_path_prefix = "Datastore.Metrics.";
|
|
static constexpr auto asynchronous_metrics_path_prefix = "Datastore.AsynchronousMetrics.";
|
|
};
|
|
|
|
}
|