#include #include #include #include #include #include #include #include namespace DB { using TraceDataType = TraceLogElement::TraceDataType; const TraceDataType::Values TraceLogElement::trace_values = { {"Real", static_cast(TraceType::Real)}, {"CPU", static_cast(TraceType::CPU)}, {"Memory", static_cast(TraceType::Memory)}, {"MemorySample", static_cast(TraceType::MemorySample)}, {"MemoryPeak", static_cast(TraceType::MemoryPeak)}, }; NamesAndTypesList TraceLogElement::getNamesAndTypes() { return { {"event_date", std::make_shared()}, {"event_time", std::make_shared()}, {"event_time_microseconds", std::make_shared(6)}, {"timestamp_ns", std::make_shared()}, {"revision", std::make_shared()}, {"trace_type", std::make_shared(trace_values)}, {"thread_id", std::make_shared()}, {"query_id", std::make_shared()}, {"trace", std::make_shared(std::make_shared())}, {"size", std::make_shared()}, }; } void TraceLogElement::appendToBlock(MutableColumns & columns) const { size_t i = 0; columns[i++]->insert(DateLUT::instance().toDayNum(event_time).toUnderType()); columns[i++]->insert(event_time); columns[i++]->insert(event_time_microseconds); columns[i++]->insert(timestamp_ns); columns[i++]->insert(ClickHouseRevision::getVersionRevision()); columns[i++]->insert(static_cast(trace_type)); columns[i++]->insert(thread_id); columns[i++]->insertData(query_id.data(), query_id.size()); columns[i++]->insert(trace); columns[i++]->insert(size); } }