ClickHouse/dbms/Storages/System/StorageSystemMetrics.cpp
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

33 lines
933 B
C++

#include <Common/CurrentMetrics.h>
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypesNumber.h>
#include <Storages/System/StorageSystemMetrics.h>
namespace DB
{
NamesAndTypesList StorageSystemMetrics::getNamesAndTypes()
{
return {
{"metric", std::make_shared<DataTypeString>()},
{"value", std::make_shared<DataTypeInt64>()},
{"description", std::make_shared<DataTypeString>()},
};
}
void StorageSystemMetrics::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const
{
for (size_t i = 0, end = CurrentMetrics::end(); i < end; ++i)
{
Int64 value = CurrentMetrics::values[i].load(std::memory_order_relaxed);
res_columns[0]->insert(CurrentMetrics::getName(CurrentMetrics::Metric(i)));
res_columns[1]->insert(value);
res_columns[2]->insert(CurrentMetrics::getDocumentation(CurrentMetrics::Metric(i)));
}
}
}