forked from facebook/mcrouter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Pool stats ODS counters to McRouter
Summary: Add Pool stats ODS counters to McRouter Reviewed By: andreazevedo Differential Revision: D6390195 fbshipit-source-id: cc48b87b4c2366883677aceee3e2545ab5509b57
- Loading branch information
1 parent
31d23d8
commit 0a9170c
Showing
19 changed files
with
376 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright (c) 2017-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the LICENSE | ||
* file in the root directory of this source tree. | ||
* | ||
*/ | ||
#pragma once | ||
|
||
#include <folly/experimental/StringKeyedUnorderedMap.h> | ||
|
||
#include "mcrouter/stats.h" | ||
|
||
namespace facebook { | ||
namespace memcache { | ||
namespace mcrouter { | ||
|
||
class PoolStats { | ||
public: | ||
PoolStats(folly::StringPiece poolName) | ||
: requestsCountStatName_( | ||
folly::to<std::string>(poolName, ".requests.sum")), | ||
finalResultErrorStatName_( | ||
folly::to<std::string>(poolName, ".final_result_error.sum")) { | ||
initStat(requestCountStat_, requestsCountStatName_); | ||
initStat(finalResultErrorStat_, finalResultErrorStatName_); | ||
} | ||
|
||
std::vector<stat_t> getStats() const { | ||
return {requestCountStat_, finalResultErrorStat_}; | ||
} | ||
|
||
void incrementRequestCount(uint64_t amount = 1) { | ||
requestCountStat_.data.uint64 += amount; | ||
} | ||
|
||
void incrementFinalResultErrorCount(uint64_t amount = 1) { | ||
finalResultErrorStat_.data.uint64 += amount; | ||
} | ||
|
||
private: | ||
void initStat(stat_t& stat, folly::StringPiece name) const { | ||
stat.name = name; | ||
stat.group = ods_stats | count_stats; | ||
stat.type = stat_uint64; | ||
stat.aggregate = 0; | ||
stat.data.uint64 = 0; | ||
} | ||
|
||
const std::string requestsCountStatName_; | ||
const std::string finalResultErrorStatName_; | ||
stat_t requestCountStat_; | ||
stat_t finalResultErrorStat_; | ||
}; | ||
|
||
} // namespace mcrouter | ||
} // namespace memcache | ||
} // namespace facebook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.