mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 04:22:03 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
33 lines
933 B
C++
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)));
|
|
}
|
|
}
|
|
|
|
}
|