Reverted system.events changes. Added docs for system.metrics. [#METR-239111]

This commit is contained in:
Vitaliy Lyudvichenko 2016-12-31 03:06:23 +03:00
parent 07d720565c
commit 694b0fad97
3 changed files with 15 additions and 26 deletions

View File

@ -1,5 +1,4 @@
#include <DB/Common/ProfileEvents.h>
#include <DB/Common/CurrentMetrics.h>
#include <DB/Columns/ColumnString.h>
#include <DB/DataTypes/DataTypeString.h>
#include <DB/DataTypes/DataTypesNumberFixed.h>
@ -11,18 +10,10 @@ namespace DB
{
enum class EventType
{
ProfileEvent = 0,
CurrentMetric = 1
};
StorageSystemEvents::StorageSystemEvents(const std::string & name_)
: name(name_),
columns
{
{"type", std::make_shared<DataTypeInt8>()},
{"event", std::make_shared<DataTypeString>()},
{"value", std::make_shared<DataTypeUInt64>()}
}
@ -55,23 +46,8 @@ BlockInputStreams StorageSystemEvents::read(
if (0 != value)
{
size_t col = 0;
block.unsafeGetByPosition(col++).column->insert(static_cast<Int64>(EventType::ProfileEvent));
block.unsafeGetByPosition(col++).column->insert(String(ProfileEvents::getDescription(ProfileEvents::Event(i))));
block.unsafeGetByPosition(col++).column->insert(value);
}
}
for (size_t i = 0, end = CurrentMetrics::end(); i < end; ++i)
{
UInt64 value = CurrentMetrics::values[i];
if (0 != value)
{
size_t col = 0;
block.unsafeGetByPosition(col++).column->insert(static_cast<Int64>(EventType::CurrentMetric));
block.unsafeGetByPosition(col++).column->insert(String(CurrentMetrics::getDescription(CurrentMetrics::Metric(i))));
block.unsafeGetByPosition(col++).column->insert(value);
block.unsafeGetByPosition(0).column->insert(String(ProfileEvents::getDescription(ProfileEvents::Event(i))));
block.unsafeGetByPosition(1).column->insert(value);
}
}

View File

@ -3138,6 +3138,11 @@ Contains information about the number of events that have occurred in the system
Example: The number of processed SELECT queries.
Columns: &#39;event String&#39; - the event name, and &#39;value UInt64&#39; - the quantity.
==system.metrics==
==system.asynchronous_metrics==
Like system.events, but show info about currently executing events or consuming resources.
Example: The number of currently executing SELECT queries; memory consumption of the system.
==system.clusters==
Contains information about clusters available in the config file and the servers in them.

View File

@ -3201,6 +3201,14 @@ query_id String - идентификатор запроса, если
Пример: количество обработанных запросов типа SELECT.
Столбцы: event String - имя события, value UInt64 - количество.
==system.metrics==
==system.asynchronous_metrics==
Содержат метрики, используемые для профилирования и мониторинга.
Обычно отражают количество событий, происходящих в данный момент в системе, или ресурсов, суммарно потребляемых системой.
Пример: количество запросов типа SELECT, исполняемых в текущий момент; количество потребляемой памяти.
system.asynchronous_metrics и system.metrics отличаются набором и способом вычисления метрик.
==system.clusters==
Содержит информацию о доступных в конфигурационном файле кластерах и серверах, которые в них входят.