Matthias Sohn 32f2566275 BucketedCallback: fix prune() to remove unset sub-metrics from registry
BucketedCallback enables defining compound metrics having a set of
sub-metrics along a dimension. This is used e.g. in CallbackMetric1
where the additional type parameter F1 defines the type of this
dimension. For each of the values of this dimension present in the
current dataset of the compound metric BucketedCallback registers a
corresponding metric in DropWizard's metric registry which isn't aware
of the relationship between a compount metric in Gerrit and the
corresponding sub-metrics.

If another measurement yields a new metric dataset which no longer
contains some of the earlier registered sub-metrics doPrune() did remove
these stale sub-metrics from the "cells" collection but missed to remove
them from DropWizard's metric registry. This had the effect that such
stale metrics no longer present in the current dataset were still
reported via the used metrics reporter plugin albeit the underlying
monitoring dataset didn't contain that data anymore.

Fix this by removing the stale sub-metrics also from the DropWizard
metric registry.

Change-Id: I767530f57883379c976614705241cbd1d1597541
2020-02-14 13:38:59 +01:00
..
2018-08-14 08:07:59 +02:00