2019-02-03 21:30:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-03-04 13:03:32 +00:00
|
|
|
#include <DataTypes/DataTypeEnum.h>
|
2020-01-16 12:37:29 +00:00
|
|
|
#include <DataTypes/DataTypesNumber.h>
|
2019-02-03 21:30:45 +00:00
|
|
|
#include <Interpreters/SystemLog.h>
|
2020-01-16 12:37:29 +00:00
|
|
|
#include <Common/QueryProfiler.h>
|
2022-11-24 19:54:39 +00:00
|
|
|
#include <Common/ProfileEvents.h>
|
|
|
|
#include <Common/TraceSender.h>
|
2022-01-10 19:01:41 +00:00
|
|
|
#include <Core/NamesAndTypes.h>
|
|
|
|
#include <Core/NamesAndAliases.h>
|
2024-01-12 15:39:22 +00:00
|
|
|
#include <Storages/ColumnsDescription.h>
|
2020-07-09 04:15:45 +00:00
|
|
|
|
2019-02-03 21:30:45 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2020-07-09 04:15:45 +00:00
|
|
|
/** Information from sampling profilers.
|
|
|
|
*/
|
2019-02-03 21:30:45 +00:00
|
|
|
struct TraceLogElement
|
|
|
|
{
|
2020-01-15 10:51:51 +00:00
|
|
|
using TraceDataType = DataTypeEnum8;
|
|
|
|
static const TraceDataType::Values trace_values;
|
2019-02-03 21:30:45 +00:00
|
|
|
|
2020-03-03 00:24:44 +00:00
|
|
|
time_t event_time{};
|
2020-11-03 15:19:24 +00:00
|
|
|
Decimal64 event_time_microseconds{};
|
2020-03-17 02:15:05 +00:00
|
|
|
UInt64 timestamp_ns{};
|
2020-03-03 00:24:44 +00:00
|
|
|
TraceType trace_type{};
|
|
|
|
UInt64 thread_id{};
|
|
|
|
String query_id{};
|
|
|
|
Array trace{};
|
2023-01-16 14:10:31 +00:00
|
|
|
/// Allocation size in bytes for TraceType::Memory and TraceType::MemorySample.
|
2022-11-24 19:54:39 +00:00
|
|
|
Int64 size{};
|
2023-01-16 14:10:31 +00:00
|
|
|
/// Allocation ptr for TraceType::MemorySample.
|
|
|
|
UInt64 ptr{};
|
2022-11-24 19:54:39 +00:00
|
|
|
/// ProfileEvent for TraceType::ProfileEvent.
|
|
|
|
ProfileEvents::Event event{ProfileEvents::end()};
|
|
|
|
/// Increment of profile event for TraceType::ProfileEvent.
|
|
|
|
ProfileEvents::Count increment{};
|
2020-01-16 12:37:29 +00:00
|
|
|
|
2019-02-03 21:30:45 +00:00
|
|
|
static std::string name() { return "TraceLog"; }
|
2024-01-12 15:39:22 +00:00
|
|
|
static ColumnsDescription getColumnsDescription();
|
2021-06-28 11:42:21 +00:00
|
|
|
static NamesAndAliases getNamesAndAliases() { return {}; }
|
2020-05-21 20:15:18 +00:00
|
|
|
void appendToBlock(MutableColumns & columns) const;
|
2019-02-03 21:30:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TraceLog : public SystemLog<TraceLogElement>
|
|
|
|
{
|
|
|
|
using SystemLog<TraceLogElement>::SystemLog;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|