Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
1830df1d
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1830df1d
编写于
9月 11, 2020
作者:
B
bharatnc
提交者:
alesapin
9月 29, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Query,QueryThread Logs - add event_time_microseconds field
上级
c6b5ef11
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
11 addition
and
0 deletion
+11
-0
src/Interpreters/QueryLog.cpp
src/Interpreters/QueryLog.cpp
+2
-0
src/Interpreters/QueryLog.h
src/Interpreters/QueryLog.h
+1
-0
src/Interpreters/QueryThreadLog.cpp
src/Interpreters/QueryThreadLog.cpp
+2
-0
src/Interpreters/QueryThreadLog.h
src/Interpreters/QueryThreadLog.h
+1
-0
src/Interpreters/ThreadStatusExt.cpp
src/Interpreters/ThreadStatusExt.cpp
+1
-0
src/Interpreters/executeQuery.cpp
src/Interpreters/executeQuery.cpp
+4
-0
未找到文件。
src/Interpreters/QueryLog.cpp
浏览文件 @
1830df1d
...
@@ -39,6 +39,7 @@ Block QueryLogElement::createBlock()
...
@@ -39,6 +39,7 @@ Block QueryLogElement::createBlock()
{
std
::
move
(
query_status_datatype
),
"type"
},
{
std
::
move
(
query_status_datatype
),
"type"
},
{
std
::
make_shared
<
DataTypeDate
>
(),
"event_date"
},
{
std
::
make_shared
<
DataTypeDate
>
(),
"event_date"
},
{
std
::
make_shared
<
DataTypeDateTime
>
(),
"event_time"
},
{
std
::
make_shared
<
DataTypeDateTime
>
(),
"event_time"
},
{
std
::
make_shared
<
DataTypeDateTime64
>
(
6
),
"event_time_microseconds"
},
{
std
::
make_shared
<
DataTypeDateTime
>
(),
"query_start_time"
},
{
std
::
make_shared
<
DataTypeDateTime
>
(),
"query_start_time"
},
{
std
::
make_shared
<
DataTypeDateTime64
>
(
6
),
"query_start_time_microseconds"
},
{
std
::
make_shared
<
DataTypeDateTime64
>
(
6
),
"query_start_time_microseconds"
},
{
std
::
make_shared
<
DataTypeUInt64
>
(),
"query_duration_ms"
},
{
std
::
make_shared
<
DataTypeUInt64
>
(),
"query_duration_ms"
},
...
@@ -97,6 +98,7 @@ void QueryLogElement::appendToBlock(MutableColumns & columns) const
...
@@ -97,6 +98,7 @@ void QueryLogElement::appendToBlock(MutableColumns & columns) const
columns
[
i
++
]
->
insert
(
type
);
columns
[
i
++
]
->
insert
(
type
);
columns
[
i
++
]
->
insert
(
DateLUT
::
instance
().
toDayNum
(
event_time
));
columns
[
i
++
]
->
insert
(
DateLUT
::
instance
().
toDayNum
(
event_time
));
columns
[
i
++
]
->
insert
(
event_time
);
columns
[
i
++
]
->
insert
(
event_time
);
columns
[
i
++
]
->
insert
(
event_time_microseconds
);
columns
[
i
++
]
->
insert
(
query_start_time
);
columns
[
i
++
]
->
insert
(
query_start_time
);
columns
[
i
++
]
->
insert
(
query_start_time_microseconds
);
columns
[
i
++
]
->
insert
(
query_start_time_microseconds
);
columns
[
i
++
]
->
insert
(
query_duration_ms
);
columns
[
i
++
]
->
insert
(
query_duration_ms
);
...
...
src/Interpreters/QueryLog.h
浏览文件 @
1830df1d
...
@@ -30,6 +30,7 @@ struct QueryLogElement
...
@@ -30,6 +30,7 @@ struct QueryLogElement
/// Depending on the type of query and type of stage, not all the fields may be filled.
/// Depending on the type of query and type of stage, not all the fields may be filled.
time_t
event_time
{};
time_t
event_time
{};
UInt64
event_time_microseconds
{};
time_t
query_start_time
{};
time_t
query_start_time
{};
UInt64
query_start_time_microseconds
{};
UInt64
query_start_time_microseconds
{};
UInt64
query_duration_ms
{};
UInt64
query_duration_ms
{};
...
...
src/Interpreters/QueryThreadLog.cpp
浏览文件 @
1830df1d
...
@@ -23,6 +23,7 @@ Block QueryThreadLogElement::createBlock()
...
@@ -23,6 +23,7 @@ Block QueryThreadLogElement::createBlock()
return
{
return
{
{
std
::
make_shared
<
DataTypeDate
>
(),
"event_date"
},
{
std
::
make_shared
<
DataTypeDate
>
(),
"event_date"
},
{
std
::
make_shared
<
DataTypeDateTime
>
(),
"event_time"
},
{
std
::
make_shared
<
DataTypeDateTime
>
(),
"event_time"
},
{
std
::
make_shared
<
DataTypeDateTime64
>
(
6
),
"event_time_microseconds"
},
{
std
::
make_shared
<
DataTypeDateTime
>
(),
"query_start_time"
},
{
std
::
make_shared
<
DataTypeDateTime
>
(),
"query_start_time"
},
{
std
::
make_shared
<
DataTypeDateTime64
>
(
6
),
"query_start_time_microseconds"
},
{
std
::
make_shared
<
DataTypeDateTime64
>
(
6
),
"query_start_time_microseconds"
},
{
std
::
make_shared
<
DataTypeUInt64
>
(),
"query_duration_ms"
},
{
std
::
make_shared
<
DataTypeUInt64
>
(),
"query_duration_ms"
},
...
@@ -73,6 +74,7 @@ void QueryThreadLogElement::appendToBlock(MutableColumns & columns) const
...
@@ -73,6 +74,7 @@ void QueryThreadLogElement::appendToBlock(MutableColumns & columns) const
columns
[
i
++
]
->
insert
(
DateLUT
::
instance
().
toDayNum
(
event_time
));
columns
[
i
++
]
->
insert
(
DateLUT
::
instance
().
toDayNum
(
event_time
));
columns
[
i
++
]
->
insert
(
event_time
);
columns
[
i
++
]
->
insert
(
event_time
);
columns
[
i
++
]
->
insert
(
event_time_microseconds
);
columns
[
i
++
]
->
insert
(
query_start_time
);
columns
[
i
++
]
->
insert
(
query_start_time
);
columns
[
i
++
]
->
insert
(
query_start_time_microseconds
);
columns
[
i
++
]
->
insert
(
query_start_time_microseconds
);
columns
[
i
++
]
->
insert
(
query_duration_ms
);
columns
[
i
++
]
->
insert
(
query_duration_ms
);
...
...
src/Interpreters/QueryThreadLog.h
浏览文件 @
1830df1d
...
@@ -16,6 +16,7 @@ namespace DB
...
@@ -16,6 +16,7 @@ namespace DB
struct
QueryThreadLogElement
struct
QueryThreadLogElement
{
{
time_t
event_time
{};
time_t
event_time
{};
UInt64
event_time_microseconds
{};
/// When query was attached to current thread
/// When query was attached to current thread
time_t
query_start_time
{};
time_t
query_start_time
{};
/// same as above but adds microsecond precision
/// same as above but adds microsecond precision
...
...
src/Interpreters/ThreadStatusExt.cpp
浏览文件 @
1830df1d
...
@@ -323,6 +323,7 @@ void ThreadStatus::logToQueryThreadLog(QueryThreadLog & thread_log)
...
@@ -323,6 +323,7 @@ void ThreadStatus::logToQueryThreadLog(QueryThreadLog & thread_log)
QueryThreadLogElement
elem
;
QueryThreadLogElement
elem
;
elem
.
event_time
=
time
(
nullptr
);
elem
.
event_time
=
time
(
nullptr
);
elem
.
event_time_microseconds
=
getCurrentTimeMicroseconds
();
elem
.
query_start_time
=
query_start_time
;
elem
.
query_start_time
=
query_start_time
;
elem
.
query_start_time_microseconds
=
query_start_time_microseconds
;
elem
.
query_start_time_microseconds
=
query_start_time_microseconds
;
elem
.
query_duration_ms
=
(
getCurrentTimeNanoseconds
()
-
query_start_time_nanoseconds
)
/
1000000U
;
elem
.
query_duration_ms
=
(
getCurrentTimeNanoseconds
()
-
query_start_time_nanoseconds
)
/
1000000U
;
...
...
src/Interpreters/executeQuery.cpp
浏览文件 @
1830df1d
...
@@ -210,6 +210,7 @@ static void onExceptionBeforeStart(const String & query_for_logging, Context & c
...
@@ -210,6 +210,7 @@ static void onExceptionBeforeStart(const String & query_for_logging, Context & c
// event_time_microseconds from the same timespec. So it can be assumed that both of these
// event_time_microseconds from the same timespec. So it can be assumed that both of these
// times are equal upto the precision of a second.
// times are equal upto the precision of a second.
elem
.
event_time
=
current_time
;
elem
.
event_time
=
current_time
;
elem
.
event_time_microseconds
=
current_time_microseconds
;
elem
.
query_start_time
=
current_time
;
elem
.
query_start_time
=
current_time
;
elem
.
query_start_time_microseconds
=
current_time_microseconds
;
elem
.
query_start_time_microseconds
=
current_time_microseconds
;
...
@@ -484,6 +485,7 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
...
@@ -484,6 +485,7 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
elem
.
type
=
QueryLogElementType
::
QUERY_START
;
elem
.
type
=
QueryLogElementType
::
QUERY_START
;
elem
.
event_time
=
current_time
;
elem
.
event_time
=
current_time
;
elem
.
event_time_microseconds
=
current_time_microseconds
;
elem
.
query_start_time
=
current_time
;
elem
.
query_start_time
=
current_time
;
elem
.
query_start_time_microseconds
=
current_time_microseconds
;
elem
.
query_start_time_microseconds
=
current_time_microseconds
;
...
@@ -555,6 +557,7 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
...
@@ -555,6 +557,7 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
elem
.
type
=
QueryLogElementType
::
QUERY_FINISH
;
elem
.
type
=
QueryLogElementType
::
QUERY_FINISH
;
elem
.
event_time
=
time
(
nullptr
);
elem
.
event_time
=
time
(
nullptr
);
elem
.
event_time_microseconds
=
getCurrentTimeMicroseconds
();
status_info_to_query_log
(
elem
,
info
,
ast
);
status_info_to_query_log
(
elem
,
info
,
ast
);
...
@@ -616,6 +619,7 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
...
@@ -616,6 +619,7 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
elem
.
type
=
QueryLogElementType
::
EXCEPTION_WHILE_PROCESSING
;
elem
.
type
=
QueryLogElementType
::
EXCEPTION_WHILE_PROCESSING
;
elem
.
event_time
=
time
(
nullptr
);
elem
.
event_time
=
time
(
nullptr
);
elem
.
event_time_microseconds
=
getCurrentTimeMicroseconds
();
elem
.
query_duration_ms
=
1000
*
(
elem
.
event_time
-
elem
.
query_start_time
);
elem
.
query_duration_ms
=
1000
*
(
elem
.
event_time
-
elem
.
query_start_time
);
elem
.
exception_code
=
getCurrentExceptionCode
();
elem
.
exception_code
=
getCurrentExceptionCode
();
elem
.
exception
=
getCurrentExceptionMessage
(
false
);
elem
.
exception
=
getCurrentExceptionMessage
(
false
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录