blob: ced363fed174b01d0071d846489bce043894e2c4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#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>()},
};
}
NamesAndAliases StorageSystemMetrics::getNamesAndAliases()
{
return {
{"name", std::make_shared<DataTypeString>(), "metric"}
};
}
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)));
}
}
}
|