Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/common/monitor/Sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class TagSet {
std::map<String, String> asMap() const { return {begin(), end()}; }

size_t size() const { return tag_set_.size(); }
bool empty() const { return tag_set_.empty(); }

Iterator begin() { return tag_set_.begin(); }
Iterator end() { return tag_set_.end(); }
Expand Down
6 changes: 3 additions & 3 deletions src/common/monitor/ScopedMetricsWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ScopedCounterWriter {
value_(value),
tagSet_(tagSet) {
int64_t currentCounter = counter_.fetch_add(value_) + value_;
if (tagSet.size() > 0)
if (!tagSet.empty())
recorder_.addSample(currentCounter, tagSet_);
else
recorder_.addSample(currentCounter);
Expand All @@ -32,7 +32,7 @@ class ScopedCounterWriter {

~ScopedCounterWriter() {
int64_t currentCounter = counter_.fetch_add(-value_) - value_;
if (tagSet_.size() > 0)
if (!tagSet_.empty())
recorder_.addSample(currentCounter, tagSet_);
else
recorder_.addSample(currentCounter);
Expand All @@ -56,7 +56,7 @@ class ScopedLatencyWriter {
: ScopedLatencyWriter(recorder, instance.empty() ? monitor::TagSet() : monitor::instanceTagSet(instance)) {}

~ScopedLatencyWriter() {
if (tagSet_.size() > 0)
if (!tagSet_.empty())
recorder_.addSample(getElapsedTime(), tagSet_);
else
recorder_.addSample(getElapsedTime());
Expand Down