mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
495c6e03aa
* Replace all Context references with std::weak_ptr * Fix shared context captured by value * Fix build * Fix Context with named sessions * Fix copy context * Fix gcc build * Merge with master and fix build * Fix gcc-9 build
33 lines
928 B
C++
33 lines
928 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, ContextPtr, 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)));
|
|
}
|
|
}
|
|
|
|
}
|