1#pragma once
2
3#include <Interpreters/SystemLog.h>
4
5
6namespace ProfileEvents
7{
8 class Counters;
9}
10
11
12namespace DB
13{
14
15struct QueryThreadLogElement
16{
17 time_t event_time{};
18 /// When query was attached to current thread
19 time_t query_start_time{};
20 /// Real time spent by the thread to execute the query
21 UInt64 query_duration_ms{};
22
23 /// The data fetched from DB in current thread to execute the query
24 UInt64 read_rows{};
25 UInt64 read_bytes{};
26
27 /// The data written to DB
28 UInt64 written_rows{};
29 UInt64 written_bytes{};
30
31 Int64 memory_usage{};
32 Int64 peak_memory_usage{};
33
34 String thread_name;
35 UInt32 thread_number{};
36 Int32 os_thread_id{};
37 UInt32 master_thread_number{};
38 Int32 master_os_thread_id{};
39
40 String query;
41 ClientInfo client_info;
42
43 std::shared_ptr<ProfileEvents::Counters> profile_counters;
44
45 static std::string name() { return "QueryThreadLog"; }
46
47 static Block createBlock();
48 void appendToBlock(Block & block) const;
49};
50
51
52class QueryThreadLog : public SystemLog<QueryThreadLogElement>
53{
54 using SystemLog<QueryThreadLogElement>::SystemLog;
55};
56
57
58}
59
60
61
62