2020-06-10 21:16:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/SystemLog.h>
|
|
|
|
#include <Common/ProfileEvents.h>
|
|
|
|
#include <Common/CurrentMetrics.h>
|
2022-01-10 19:01:41 +00:00
|
|
|
#include <Core/NamesAndTypes.h>
|
|
|
|
#include <Core/NamesAndAliases.h>
|
2020-06-10 21:16:58 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <atomic>
|
|
|
|
#include <ctime>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2021-06-28 11:42:21 +00:00
|
|
|
using AsynchronousMetricValue = double;
|
|
|
|
using AsynchronousMetricValues = std::unordered_map<std::string, AsynchronousMetricValue>;
|
2020-06-10 21:16:58 +00:00
|
|
|
|
|
|
|
/** AsynchronousMetricLog is a log of metric values measured at regular time interval.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct AsynchronousMetricLogElement
|
|
|
|
{
|
|
|
|
UInt16 event_date;
|
|
|
|
time_t event_time;
|
2020-11-03 15:19:24 +00:00
|
|
|
Decimal64 event_time_microseconds;
|
2020-06-10 21:16:58 +00:00
|
|
|
std::string metric_name;
|
|
|
|
double value;
|
|
|
|
|
|
|
|
static std::string name() { return "AsynchronousMetricLog"; }
|
2021-06-28 11:42:21 +00:00
|
|
|
static NamesAndTypesList getNamesAndTypes();
|
|
|
|
static NamesAndAliases getNamesAndAliases() { return {}; }
|
2020-06-10 21:16:58 +00:00
|
|
|
void appendToBlock(MutableColumns & columns) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
class AsynchronousMetricLog : public SystemLog<AsynchronousMetricLogElement>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
using SystemLog<AsynchronousMetricLogElement>::SystemLog;
|
|
|
|
|
|
|
|
void addValues(const AsynchronousMetricValues &);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|