app/vminsert/netstorage: properly update vm_rpc_rerouted_rows_processed_total metric

Previously this metric wasn't updated because of improper defer call.
See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/955

Thanks to @xemxx for spotting the bug.
This commit is contained in:
Aliaksandr Valialkin 2020-12-11 13:05:27 +02:00
parent 82d26d9dfe
commit 9e79fc27c8

View file

@ -585,7 +585,9 @@ func getHealthyStorageNodesBlocking(stopCh <-chan struct{}) []*storageNode {
func spreadReroutedBufToStorageNodesBlocking(stopCh <-chan struct{}, br *bufRows) {
var mr storage.MetricRow
rowsProcessed := 0
defer reroutedRowsProcessed.Add(rowsProcessed)
defer func() {
reroutedRowsProcessed.Add(rowsProcessed)
}()
sns := getHealthyStorageNodesBlocking(stopCh)
if len(sns) == 0 {