Skip to content

Commit

Permalink
Update gauges when a subset LB is destroyed
Browse files Browse the repository at this point in the history
Without these updates, the gauges will be incorrect after a hot
restart.

Fixes envoyproxy#3916

Signed-off-by: Raul Gutierrez Segales <rgs@pinterest.com>
  • Loading branch information
Raul Gutierrez Segales committed Jul 20, 2018
1 parent 8ed7c15 commit d5ecf61
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion source/common/upstream/subset_lb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,17 @@ SubsetLoadBalancer::SubsetLoadBalancer(
});
}

SubsetLoadBalancer::~SubsetLoadBalancer() { original_priority_set_callback_handle_->remove(); }
SubsetLoadBalancer::~SubsetLoadBalancer() {
original_priority_set_callback_handle_->remove();

// Ensure gauges reflect correct values.
forEachSubset(subsets_, [&](LbSubsetEntryPtr entry) {
if (entry->initialized() && entry->active()) {
stats_.lb_subsets_removed_.inc();
stats_.lb_subsets_active_.dec();
}
});
}

void SubsetLoadBalancer::refreshSubsets() {
for (auto& host_set : original_priority_set_.hostSetsPerPriority()) {
Expand Down

0 comments on commit d5ecf61

Please sign in to comment.