Skip to content

Commit

Permalink
[fix] metric latnecy error
Browse files Browse the repository at this point in the history
Signed-off-by: Cyber-SiKu <Cyber-SiKu@outlook.com>
  • Loading branch information
Cyber-SiKu committed Oct 16, 2023
1 parent 92f1e1a commit 2216ba1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
10 changes: 8 additions & 2 deletions curvefs/src/client/kvclient/kvclient_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ struct SetKVCacheTask {
explicit SetKVCacheTask(
const std::string& k, const char* val, const uint64_t len,
SetKVCacheDone done = [](const std::shared_ptr<SetKVCacheTask>&) {})
: key(k), value(val), length(len), res(false), done(std::move(done)) {}
: key(k),
value(val),
length(len),
res(false),
done(std::move(done)),
timer(butil::Timer::STARTED) {}
};

struct GetKVCacheTask {
Expand All @@ -84,7 +89,8 @@ struct GetKVCacheTask {
offset(off),
length(len),
res(false),
done(std::move(done)) {}
done(std::move(done)),
timer(butil::Timer::STARTED) {}
};

class KVClientManager {
Expand Down
1 change: 1 addition & 0 deletions curvefs/src/client/s3/disk_cache_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ int DiskCacheManagerImpl::WriteClosure(
// set the returned value
// it is need in CallBack
context->retCode = ret;
context->timer.stop();
context->cb(context);
VLOG(9) << "WriteClosure end, name: " << context->key;
return 0;
Expand Down
6 changes: 4 additions & 2 deletions src/common/s3_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ struct GetObjectAsyncContext : public Aws::Client::AsyncCallerContext {
offset(offset),
len(len),
cb(std::move(cb)),
type(type) {}
type(type),
timer(butil::Timer::STARTED) {}
};

/*
Expand Down Expand Up @@ -171,7 +172,8 @@ struct PutObjectAsyncContext : public Aws::Client::AsyncCallerContext {
buffer(buffer),
bufferSize(bufferSize),
cb(std::move(cb)),
type(type) {}
type(type),
timer(butil::Timer::STARTED) {}
};

class S3Adapter {
Expand Down

0 comments on commit 2216ba1

Please sign in to comment.