add hostname column to remaining tables

This commit is contained in:
Bharat Nallan Chakravarthy 2023-10-23 22:45:58 -07:00
parent 1285ee74df
commit c892e2c01d
9 changed files with 33 additions and 0 deletions

View File

@ -1,8 +1,10 @@
#include <Interpreters/BackupLog.h>
#include <base/getFQDNOrHostName.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime64.h>
#include <DataTypes/DataTypeEnum.h>
#include <DataTypes/DataTypeLowCardinality.h>
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypesNumber.h>
@ -20,6 +22,7 @@ NamesAndTypesList BackupLogElement::getNamesAndTypes()
{
return
{
{"hostname", std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>())},
{"event_date", std::make_shared<DataTypeDate>()},
{"event_time_microseconds", std::make_shared<DataTypeDateTime64>(6)},
{"id", std::make_shared<DataTypeString>()},
@ -41,6 +44,7 @@ NamesAndTypesList BackupLogElement::getNamesAndTypes()
void BackupLogElement::appendToBlock(MutableColumns & columns) const
{
size_t i = 0;
columns[i++]->insert(getFQDNOrHostName());
columns[i++]->insert(DateLUT::instance().toDayNum(std::chrono::system_clock::to_time_t(event_time)).toUnderType());
columns[i++]->insert(event_time_usec);
columns[i++]->insert(info.id);

View File

@ -1,5 +1,7 @@
#include <base/getFQDNOrHostName.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/DataTypeLowCardinality.h>
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeMap.h>
@ -34,6 +36,7 @@ NamesAndTypesList FilesystemCacheLogElement::getNamesAndTypes()
};
return {
{"hostname", std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>())},
{"event_date", std::make_shared<DataTypeDate>()},
{"event_time", std::make_shared<DataTypeDateTime>()},
{"query_id", std::make_shared<DataTypeString>()},
@ -54,6 +57,7 @@ void FilesystemCacheLogElement::appendToBlock(MutableColumns & columns) const
{
size_t i = 0;
columns[i++]->insert(getFQDNOrHostName());
columns[i++]->insert(DateLUT::instance().toDayNum(event_time).toUnderType());
columns[i++]->insert(event_time);

View File

@ -1,6 +1,8 @@
#include <base/getFQDNOrHostName.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/DataTypeDateTime64.h>
#include <DataTypes/DataTypeLowCardinality.h>
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypesNumber.h>
#include <Interpreters/FilesystemReadPrefetchesLog.h>
@ -12,6 +14,7 @@ namespace DB
NamesAndTypesList FilesystemReadPrefetchesLogElement::getNamesAndTypes()
{
return {
{"hostname", std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>())},
{"event_date", std::make_shared<DataTypeDate>()},
{"event_time", std::make_shared<DataTypeDateTime>()},
{"query_id", std::make_shared<DataTypeString>()},
@ -33,6 +36,7 @@ void FilesystemReadPrefetchesLogElement::appendToBlock(MutableColumns & columns)
{
size_t i = 0;
columns[i++]->insert(getFQDNOrHostName());
columns[i++]->insert(DateLUT::instance().toDayNum(event_time).toUnderType());
columns[i++]->insert(event_time);
columns[i++]->insert(query_id);

View File

@ -1,5 +1,6 @@
#include <Interpreters/OpenTelemetrySpanLog.h>
#include <base/getFQDNOrHostName.h>
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
@ -30,6 +31,7 @@ NamesAndTypesList OpenTelemetrySpanLogElement::getNamesAndTypes()
auto low_cardinality_string = std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>());
return {
{"hostname", low_cardinality_string},
{"trace_id", std::make_shared<DataTypeUUID>()},
{"span_id", std::make_shared<DataTypeUInt64>()},
{"parent_span_id", std::make_shared<DataTypeUInt64>()},
@ -67,6 +69,7 @@ void OpenTelemetrySpanLogElement::appendToBlock(MutableColumns & columns) const
{
size_t i = 0;
columns[i++]->insert(getFQDNOrHostName());
columns[i++]->insert(trace_id);
columns[i++]->insert(span_id);
columns[i++]->insert(parent_span_id);

View File

@ -1,5 +1,6 @@
#include <Interpreters/ProcessorsProfileLog.h>
#include <base/getFQDNOrHostName.h>
#include <Common/ClickHouseRevision.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
@ -20,6 +21,7 @@ NamesAndTypesList ProcessorProfileLogElement::getNamesAndTypes()
{
return
{
{"hostname", std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>())},
{"event_date", std::make_shared<DataTypeDate>()},
{"event_time", std::make_shared<DataTypeDateTime>()},
{"event_time_microseconds", std::make_shared<DataTypeDateTime64>(6)},
@ -46,6 +48,7 @@ void ProcessorProfileLogElement::appendToBlock(MutableColumns & columns) const
{
size_t i = 0;
columns[i++]->insert(getFQDNOrHostName());
columns[i++]->insert(DateLUT::instance().toDayNum(event_time).toUnderType());
columns[i++]->insert(event_time);
columns[i++]->insert(event_time_microseconds);

View File

@ -1,5 +1,7 @@
#include <base/getFQDNOrHostName.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeDateTime.h>
#include <DataTypes/DataTypeLowCardinality.h>
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeNullable.h>
@ -21,6 +23,7 @@ NamesAndTypesList S3QueueLogElement::getNamesAndTypes()
{"Failed", static_cast<Int8>(S3QueueLogElement::S3QueueStatus::Failed)},
});
return {
{"hostname", std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>())},
{"event_date", std::make_shared<DataTypeDate>()},
{"event_time", std::make_shared<DataTypeDateTime>()},
{"table_uuid", std::make_shared<DataTypeString>()},
@ -37,6 +40,7 @@ NamesAndTypesList S3QueueLogElement::getNamesAndTypes()
void S3QueueLogElement::appendToBlock(MutableColumns & columns) const
{
size_t i = 0;
columns[i++]->insert(getFQDNOrHostName());
columns[i++]->insert(DateLUT::instance().toDayNum(event_time).toUnderType());
columns[i++]->insert(event_time);
columns[i++]->insert(table_uuid);

View File

@ -1,5 +1,6 @@
#include <Interpreters/SessionLog.h>
#include <base/getFQDNOrHostName.h>
#include <Access/ContextAccess.h>
#include <Access/User.h>
#include <Access/EnabledRolesInfo.h>
@ -120,6 +121,7 @@ NamesAndTypesList SessionLogElement::getNamesAndTypes()
return
{
{"hostname", lc_string_datatype},
{"type", std::move(event_type)},
{"auth_id", std::make_shared<DataTypeUUID>()},
{"session_id", std::make_shared<DataTypeString>()},
@ -156,6 +158,7 @@ void SessionLogElement::appendToBlock(MutableColumns & columns) const
size_t i = 0;
columns[i++]->insert(getFQDNOrHostName());
columns[i++]->insert(type);
columns[i++]->insert(auth_id);
columns[i++]->insert(session_id);

View File

@ -1,3 +1,4 @@
#include <base/getFQDNOrHostName.h>
#include <Interpreters/TransactionsInfoLog.h>
#include <Interpreters/TransactionVersionMetadata.h>
#include <Interpreters/Context.h>
@ -8,6 +9,7 @@
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeEnum.h>
#include <DataTypes/DataTypeFactory.h>
#include <DataTypes/DataTypeLowCardinality.h>
#include <DataTypes/DataTypeString.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeUUID.h>
@ -32,6 +34,7 @@ NamesAndTypesList TransactionsInfoLogElement::getNamesAndTypes()
return
{
{"hostname", std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>())},
{"type", std::move(type_enum)},
{"event_date", std::make_shared<DataTypeDate>()},
{"event_time", std::make_shared<DataTypeDateTime64>(6)},
@ -69,6 +72,7 @@ void TransactionsInfoLogElement::appendToBlock(MutableColumns & columns) const
assert(type != UNKNOWN);
size_t i = 0;
columns[i++]->insert(getFQDNOrHostName());
columns[i++]->insert(type);
auto event_time_seconds = event_time / 1000000;
columns[i++]->insert(DateLUT::instance().toDayNum(event_time_seconds).toUnderType());

View File

@ -1,3 +1,4 @@
#include <base/getFQDNOrHostName.h>
#include <Interpreters/ZooKeeperLog.h>
#include <Columns/ColumnArray.h>
#include <Columns/ColumnString.h>
@ -5,6 +6,7 @@
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypeDateTime64.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeLowCardinality.h>
#include <DataTypes/DataTypeNullable.h>
#include <DataTypes/DataTypeEnum.h>
#include <DataTypes/DataTypeFactory.h>
@ -118,6 +120,7 @@ NamesAndTypesList ZooKeeperLogElement::getNamesAndTypes()
return
{
{"hostname", std::make_shared<DataTypeLowCardinality>(std::make_shared<DataTypeString>())},
{"type", std::move(type_enum)},
{"event_date", std::make_shared<DataTypeDate>()},
{"event_time", std::make_shared<DataTypeDateTime64>(6)},
@ -168,6 +171,7 @@ void ZooKeeperLogElement::appendToBlock(MutableColumns & columns) const
assert(type != UNKNOWN);
size_t i = 0;
columns[i++]->insert(getFQDNOrHostName());
columns[i++]->insert(type);
auto event_time_seconds = event_time / 1000000;
columns[i++]->insert(DateLUT::instance().toDayNum(event_time_seconds).toUnderType());