ClickHouse/src/Interpreters/AsynchronousMetricLog.h

46 lines
1.1 KiB
C++
Raw Normal View History

2020-06-10 21:16:58 +00:00
#pragma once
#include <Interpreters/SystemLog.h>
#include <Common/ProfileEvents.h>
#include <Common/CurrentMetrics.h>
#include <Core/NamesAndTypes.h>
#include <Core/NamesAndAliases.h>
2020-06-10 21:16:58 +00:00
#include <vector>
#include <atomic>
#include <ctime>
namespace DB
{
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"; }
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 &);
};
}