2017-04-01 09:19:00 +00:00
|
|
|
#include <Common/ProfileEvents.h>
|
2020-09-02 12:28:29 +00:00
|
|
|
#include <Interpreters/Context.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <DataTypes/DataTypeString.h>
|
|
|
|
#include <DataTypes/DataTypesNumber.h>
|
|
|
|
#include <Storages/System/StorageSystemEvents.h>
|
2014-01-03 08:20:13 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2018-07-24 14:28:56 +00:00
|
|
|
NamesAndTypesList StorageSystemEvents::getNamesAndTypes()
|
2018-01-25 14:42:39 +00:00
|
|
|
{
|
2018-07-24 14:28:56 +00:00
|
|
|
return {
|
2017-12-02 02:47:12 +00:00
|
|
|
{"event", std::make_shared<DataTypeString>()},
|
2018-03-10 17:03:57 +00:00
|
|
|
{"value", std::make_shared<DataTypeUInt64>()},
|
2018-09-01 23:13:17 +00:00
|
|
|
{"description", std::make_shared<DataTypeString>()},
|
2018-07-24 14:28:56 +00:00
|
|
|
};
|
2014-01-03 08:20:13 +00:00
|
|
|
}
|
|
|
|
|
2021-04-10 23:33:54 +00:00
|
|
|
void StorageSystemEvents::fillData(MutableColumns & res_columns, ContextPtr context, const SelectQueryInfo &) const
|
2014-01-03 08:20:13 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
for (size_t i = 0, end = ProfileEvents::end(); i < end; ++i)
|
|
|
|
{
|
2018-02-01 17:55:08 +00:00
|
|
|
UInt64 value = ProfileEvents::global_counters[i];
|
2014-01-03 08:20:13 +00:00
|
|
|
|
2021-04-10 23:33:54 +00:00
|
|
|
if (0 != value || context->getSettingsRef().system_events_show_zero_values)
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
2018-10-22 08:54:54 +00:00
|
|
|
res_columns[0]->insert(ProfileEvents::getName(ProfileEvents::Event(i)));
|
2017-12-16 00:49:03 +00:00
|
|
|
res_columns[1]->insert(value);
|
2018-10-22 08:54:54 +00:00
|
|
|
res_columns[2]->insert(ProfileEvents::getDocumentation(ProfileEvents::Event(i)));
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
|
|
|
}
|
2014-01-03 08:20:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|