2018-07-24 14:28:56 +00:00
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Common/CurrentMetrics.h>
|
|
|
|
#include <DataTypes/DataTypeString.h>
|
|
|
|
#include <DataTypes/DataTypesNumber.h>
|
|
|
|
#include <Storages/System/StorageSystemMetrics.h>
|
2016-01-20 21:32:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2018-07-24 14:28:56 +00:00
|
|
|
NamesAndTypesList StorageSystemMetrics::getNamesAndTypes()
|
2018-01-25 14:42:39 +00:00
|
|
|
{
|
2018-07-24 14:28:56 +00:00
|
|
|
return {
|
2017-12-02 02:47:12 +00:00
|
|
|
{"metric", std::make_shared<DataTypeString>()},
|
2018-07-24 14:28:56 +00:00
|
|
|
{"value", std::make_shared<DataTypeInt64>()},
|
2018-09-01 19:51:38 +00:00
|
|
|
{"description", std::make_shared<DataTypeString>()},
|
2018-07-24 14:28:56 +00:00
|
|
|
};
|
2016-01-20 21:32:01 +00:00
|
|
|
}
|
|
|
|
|
2018-07-24 14:28:56 +00:00
|
|
|
void StorageSystemMetrics::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const
|
2016-01-20 21:32:01 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
for (size_t i = 0, end = CurrentMetrics::end(); i < end; ++i)
|
|
|
|
{
|
|
|
|
Int64 value = CurrentMetrics::values[i].load(std::memory_order_relaxed);
|
2016-01-20 21:32:01 +00:00
|
|
|
|
2018-10-22 08:54:54 +00:00
|
|
|
res_columns[0]->insert(CurrentMetrics::getName(CurrentMetrics::Metric(i)));
|
2017-12-16 00:49:03 +00:00
|
|
|
res_columns[1]->insert(value);
|
2018-10-22 08:54:54 +00:00
|
|
|
res_columns[2]->insert(CurrentMetrics::getDocumentation(CurrentMetrics::Metric(i)));
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
2016-01-20 21:32:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|