Add cpu and io indicates to audit log (#531)

This commit is contained in:
chenhao
2019-01-17 12:43:15 +08:00
committed by ZHAO Chun
parent 33b133c6ff
commit 0e5b193243
44 changed files with 608 additions and 162 deletions

View File

@ -31,9 +31,13 @@ void GetResultBatchCtx::on_failure(const Status& status) {
delete this;
}
void GetResultBatchCtx::on_close(int64_t packet_seq) {
void GetResultBatchCtx::on_close(int64_t packet_seq,
QueryStatistics* statistics) {
Status status;
status.to_protobuf(result->mutable_status());
if (statistics != nullptr) {
statistics->to_pb(result->mutable_query_statistics());
}
result->set_packet_seq(packet_seq);
result->set_eos(true);
done->Run();
@ -183,7 +187,7 @@ void BufferControlBlock::get_batch(GetResultBatchCtx* ctx) {
return;
}
if (_is_close) {
ctx->on_close(_packet_num);
ctx->on_close(_packet_num, _query_statistics.get());
return;
}
// no ready data, push ctx to waiting list
@ -200,7 +204,7 @@ Status BufferControlBlock::close(Status exec_status) {
if (!_waiting_rpc.empty()) {
if (_status.ok()) {
for (auto& ctx : _waiting_rpc) {
ctx->on_close(_packet_num);
ctx->on_close(_packet_num, _query_statistics.get());
}
} else {
for (auto& ctx : _waiting_rpc) {