#include #include #include #include #include #include #include using namespace DB; using TimerDataType = TraceLogElement::TimerDataType; const TimerDataType::Values TraceLogElement::timer_values = { {"Real", static_cast(TimerType::Real)}, {"CPU", static_cast(TimerType::Cpu)} }; Block TraceLogElement::createBlock() { return { {std::make_shared(), "event_date"}, {std::make_shared(), "event_time"}, {std::make_shared(), "revision"}, {std::make_shared(timer_values), "timer_type"}, {std::make_shared(), "thread_number"}, {std::make_shared(), "query_id"}, {std::make_shared(std::make_shared()), "trace"} }; } void TraceLogElement::appendToBlock(Block & block) const { MutableColumns columns = block.mutateColumns(); size_t i = 0; columns[i++]->insert(DateLUT::instance().toDayNum(event_time)); columns[i++]->insert(event_time); columns[i++]->insert(ClickHouseRevision::get()); columns[i++]->insert(static_cast(timer_type)); columns[i++]->insert(thread_number); columns[i++]->insertData(query_id.data(), query_id.size()); columns[i++]->insert(trace); block.setColumns(std::move(columns)); }