Skip to content

Commit

Permalink
Fix metrics missing caused by invalid io stats
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Nov 27, 2023
1 parent e4f2c01 commit ee7c948
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion velox/dwio/common/CachedBufferedInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ class CachedBufferedInput : public BufferedInput {
: BufferedInput(
std::move(readFile),
readerOptions.getMemoryPool(),
metricsLog),
metricsLog,
ioStats.get()),
cache_(cache),
fileNum_(fileNum),
tracker_(std::move(tracker)),
Expand Down
3 changes: 2 additions & 1 deletion velox/dwio/common/DirectBufferedInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ class DirectBufferedInput : public BufferedInput {
: BufferedInput(
std::move(readFile),
readerOptions.getMemoryPool(),
metricsLog),
metricsLog,
ioStats.get()),
fileNum_(fileNum),
tracker_(std::move(tracker)),
groupId_(groupId),
Expand Down
4 changes: 2 additions & 2 deletions velox/dwio/common/InputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ void ReadFileInputStream::vread(
size_t(0),
[&](size_t acc, const auto& r) { return acc + r.length; });
logRead(regions[0].offset, length, purpose);
auto readStartMs = getCurrentTimeMs();
auto readStartMicro = getCurrentTimeMicro();
readFile_->preadv(regions, iobufs);
if (stats_) {
stats_->incRawBytesRead(length);
stats_->incTotalScanTime(getCurrentTimeMs() - readStartMs);
stats_->incTotalScanTime((getCurrentTimeMicro() - readStartMicro) * 1000);
}
}

Expand Down

0 comments on commit ee7c948

Please sign in to comment.