Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A metrics reporting issue was observed where infrequent updates to percentile timers resulted in inconsistent reporting of metrics values. Unusual peaks and valleys were seen on the query side. Capturing measurement reporting from the spectatord process revealed that the base timer values were being reported in a consistent manner, but some of the percentile counters were missing.
The percentile timer meters kept a local cache of the percentile counters, with shared pointer references to corresponding meters in the Registry. When the Registry expires meters, it does so based upon last update time, rather than the number of pointers still held. Thus, infrequently used percentile counters were removed from the Registry, but remained within the local percentile timer cache. The cached values would be updated, but this would not translate to the Registry, and there was no opportunity to recreate them.
The fix is to remove the local percentile counter cache from the percentile timer meter, and rely on the Registry to keep track of all counters. If one is expired, it will then be recreated. This will add a little bit of overhead, but it should be minimal.
The same applies to the percentile distribution summaries.