ClickHouse/dbms/Storages/System/StorageSystemMetrics.cpp

33 lines
933 B
C++
Raw Normal View History

#include <Common/CurrentMetrics.h>
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypesNumber.h>
#include <Storages/System/StorageSystemMetrics.h>
namespace DB
{
NamesAndTypesList StorageSystemMetrics::getNamesAndTypes()
{
return {
2017-12-02 02:47:12 +00:00
{"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)));
}
}
}