1 | #include <DataTypes/DataTypeString.h> |
---|---|
2 | #include <DataTypes/DataTypesNumber.h> |
3 | #include <Interpreters/AsynchronousMetrics.h> |
4 | #include <Storages/System/StorageSystemAsynchronousMetrics.h> |
5 | |
6 | |
7 | namespace DB |
8 | { |
9 | |
10 | NamesAndTypesList StorageSystemAsynchronousMetrics::getNamesAndTypes() |
11 | { |
12 | return { |
13 | {"metric", std::make_shared<DataTypeString>()}, |
14 | {"value", std::make_shared<DataTypeFloat64>()}, |
15 | }; |
16 | } |
17 | |
18 | |
19 | StorageSystemAsynchronousMetrics::StorageSystemAsynchronousMetrics(const std::string & name_, const AsynchronousMetrics & async_metrics_) |
20 | : IStorageSystemOneBlock(name_), async_metrics(async_metrics_) |
21 | { |
22 | } |
23 | |
24 | void StorageSystemAsynchronousMetrics::fillData(MutableColumns & res_columns, const Context &, const SelectQueryInfo &) const |
25 | { |
26 | auto async_metrics_values = async_metrics.getValues(); |
27 | for (const auto & name_value : async_metrics_values) |
28 | { |
29 | res_columns[0]->insert(name_value.first); |
30 | res_columns[1]->insert(name_value.second); |
31 | } |
32 | } |
33 | |
34 | } |
35 |