From 2567302c9b13262f63f4532c5ca2bfc29732d77e Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Mon, 13 Jun 2022 10:32:48 +0100 Subject: [PATCH] Use correct counter when deleting lines Signed-off-by: Michel Hollands --- .../shipper/compactor/deletion/delete_requests_manager.go | 2 +- .../compactor/deletion/delete_requests_manager_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/storage/stores/shipper/compactor/deletion/delete_requests_manager.go b/pkg/storage/stores/shipper/compactor/deletion/delete_requests_manager.go index b2f7ef18a9ac..e5c0759d66e7 100644 --- a/pkg/storage/stores/shipper/compactor/deletion/delete_requests_manager.go +++ b/pkg/storage/stores/shipper/compactor/deletion/delete_requests_manager.go @@ -119,7 +119,7 @@ func (d *DeleteRequestsManager) loadDeleteRequestsToProcess() error { if deleteRequest.CreatedAt.Add(d.deleteRequestCancelPeriod).Add(time.Minute).After(model.Now()) { continue } - deleteRequest.deletedLinesTotal = d.metrics.deleteRequestsProcessedTotal.WithLabelValues(deleteRequest.UserID) + deleteRequest.deletedLinesTotal = d.metrics.deletedLinesTotal.WithLabelValues(deleteRequest.UserID) d.deleteRequestsToProcess = append(d.deleteRequestsToProcess, deleteRequest) } diff --git a/pkg/storage/stores/shipper/compactor/deletion/delete_requests_manager_test.go b/pkg/storage/stores/shipper/compactor/deletion/delete_requests_manager_test.go index 87c4bb65f903..2712084210d2 100644 --- a/pkg/storage/stores/shipper/compactor/deletion/delete_requests_manager_test.go +++ b/pkg/storage/stores/shipper/compactor/deletion/delete_requests_manager_test.go @@ -293,6 +293,10 @@ func TestDeleteRequestsManager_Expired(t *testing.T) { mgr := NewDeleteRequestsManager(mockDeleteRequestsStore{deleteRequests: tc.deleteRequestsFromStore}, time.Hour, nil, tc.deletionMode) require.NoError(t, mgr.loadDeleteRequestsToProcess()) + for _, dr := range mgr.deleteRequestsToProcess { + require.Contains(t, dr.deletedLinesTotal.Desc().String(), "loki_compactor_deleted_lines") + } + isExpired, nonDeletedIntervals := mgr.Expired(chunkEntry, model.Now()) require.Equal(t, tc.expectedResp.isExpired, isExpired) for idx, interval := range nonDeletedIntervals {