Skip to content

Commit

Permalink
add stat to measure additional config age
Browse files Browse the repository at this point in the history
Summary: If we call two reconfiguration callbacks for two config sources, we need to measure the ages for both.

Reviewed By: stuclar

Differential Revision: D64807435

fbshipit-source-id: b0c1f777fb2a193451d4d1bf1fe21e81e0982187
  • Loading branch information
Lenar Fatikhov authored and facebook-github-bot committed Oct 23, 2024
1 parent 8d977e6 commit 30de3e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mcrouter/stat_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,10 @@ STAT(retrans_per_kbyte_avg, stat_double, 0, .dbl = 0.0)
*/
#define GROUP ods_stats | detailed_stats
STUI(config_age, 0, 0)
STUI(config_age_sr, 0, 0)
STUI(config_last_attempt, 0, 0)
STUI(config_last_success, 0, 0)
STUI(config_last_sr_update, 0, 0)
STUI(config_failures, 0, 0)
STUI(configs_from_disk, 0, 0)
STUI(config_partial_reconfig_attempt, 0, 0)
Expand Down
7 changes: 7 additions & 0 deletions mcrouter/stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ void prepare_stats(CarbonRouterInstanceBase& router, stat_t* stats) {
init_stats(stats);

uint64_t config_last_success = 0;
uint64_t config_last_sr_update = 0;
uint64_t destinationBatchesSum = 0;
uint64_t destinationRequestsSum = 0;
uint64_t outstandingGetReqsTotal = 0;
Expand All @@ -396,6 +397,10 @@ void prepare_stats(CarbonRouterInstanceBase& router, stat_t* stats) {
auto proxy = router.getProxyBase(i);
config_last_success = std::max(
config_last_success, proxy->stats().getValue(config_last_success_stat));
config_last_sr_update = std::max(
config_last_sr_update,
proxy->stats().getValue(config_last_sr_update_stat));

destinationBatchesSum +=
proxy->stats().getStatValueWithinWindow(destination_batches_sum_stat);
destinationRequestsSum +=
Expand Down Expand Up @@ -486,6 +491,8 @@ void prepare_stats(CarbonRouterInstanceBase& router, stat_t* stats) {
stat_set(stats, time_stat, now);
stat_set(stats, uptime_stat, now - router.startTime());
stat_set(stats, config_age_stat, now - config_last_success);
stat_set(stats, config_age_sr_stat, now - config_last_sr_update);
stat_set(stats, config_last_sr_update_stat, config_last_sr_update);
stat_set(stats, config_last_success_stat, config_last_success);
stat_set(
stats,
Expand Down

0 comments on commit 30de3e6

Please sign in to comment.