#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)}, }; Block TraceLogElement::createBlock() { return { {std::make_shared(), "event_date"}, {std::make_shared(), "event_time"}, {std::make_shared(6), "event_time_microseconds"}, {std::make_shared(), "timestamp_ns"}, {std::make_shared(), "revision"}, {std::make_shared(trace_values), "trace_type"}, {std::make_shared(), "thread_id"}, {std::make_shared(), "query_id"}, {std::make_shared(std::make_shared()), "trace"}, {std::make_shared(), "size"}, }; } void TraceLogElement::appendToBlock(MutableColumns & columns) const { size_t i = 0; columns[i++]->insert(DateLUT::instance().toDayNum(event_time)); 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); } }