2018-07-24 14:32:54 +00:00
|
|
|
#include <DataTypes/DataTypeString.h>
|
|
|
|
#include <DataTypes/DataTypesNumber.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Interpreters/AsynchronousMetrics.h>
|
2018-07-24 14:28:56 +00:00
|
|
|
#include <Storages/System/StorageSystemAsynchronousMetrics.h>
|
2016-10-24 04:06:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2018-07-24 14:28:56 +00:00
|
|
|
NamesAndTypesList StorageSystemAsynchronousMetrics::getNamesAndTypes()
|
2016-10-24 04:06:27 +00:00
|
|
|
{
|
2018-07-24 14:28:56 +00:00
|
|
|
return {
|
2018-01-25 14:42:39 +00:00
|
|
|
{"metric", std::make_shared<DataTypeString>()},
|
|
|
|
{"value", std::make_shared<DataTypeFloat64>()},
|
2018-07-24 14:28:56 +00:00
|
|
|
};
|
2016-10-24 04:06:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-12 20:40:13 +00:00
|
|
|
StorageSystemAsynchronousMetrics::StorageSystemAsynchronousMetrics(const StorageID & table_id_, const AsynchronousMetrics & async_metrics_)
|
|
|
|
: IStorageSystemOneBlock(table_id_), async_metrics(async_metrics_)
|
2016-10-24 04:06:27 +00:00
|
|
|
{
|
2018-07-24 14:28:56 +00:00
|
|
|
}
|
2016-10-24 04:06:27 +00:00
|
|
|
|
2021-04-10 23:33:54 +00:00
|
|
|
void StorageSystemAsynchronousMetrics::fillData(MutableColumns & res_columns, ContextPtr, const SelectQueryInfo &) const
|
2018-07-24 14:28:56 +00:00
|
|
|
{
|
2016-10-24 04:06:27 +00:00
|
|
|
auto async_metrics_values = async_metrics.getValues();
|
|
|
|
for (const auto & name_value : async_metrics_values)
|
|
|
|
{
|
2017-12-16 00:49:03 +00:00
|
|
|
res_columns[0]->insert(name_value.first);
|
|
|
|
res_columns[1]->insert(name_value.second);
|
2016-10-24 04:06:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|