-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ring/ring.go: reactive update of metrics
When writing e2e tests for services using Ring, it is natural to wait for having all tokens assigned. With the default 10s interval for updating metrics, this slows down tests considerably. This was not the case before PR 50 where metrics were collected on request. This commit allows the update of metrics when there is a change in the ring, i.e. when KV.Watch() is triggered. To not hold up watching and also skip through high frequency changes, the metrics update is decoupled from watch via a channel. A further optimization is to not hold the lock while calculating the metrics, just copy the Ring.ringDesc pointer which points to a constant state. Signed-off-by: György Krajcsovits <[email protected]>
- Loading branch information
Showing
1 changed file
with
56 additions
and
10 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