Skip to content

Commit

Permalink
Compact: Remove spam of replica label removed log (#6088)
Browse files Browse the repository at this point in the history
* Remove spam of replica label removed log

Signed-off-by: Douglas Camata <[email protected]>

* Reduce amount of removed replica label instead of removing it

Signed-off-by: Douglas Camata <[email protected]>

* Reformat code

Signed-off-by: Douglas Camata <[email protected]>

---------

Signed-off-by: Douglas Camata <[email protected]>
  • Loading branch information
douglascamata authored Feb 2, 2023
1 parent 5f9c6c4 commit 84959bc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/block/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ func (r *ReplicaLabelRemover) Filter(_ context.Context, metas map[ulid.ULID]*met
return nil
}

countReplicaLabelRemoved := make(map[string]int, len(metas))
for u, meta := range metas {
l := make(map[string]string)
for n, v := range meta.Thanos.Labels {
Expand All @@ -717,8 +718,8 @@ func (r *ReplicaLabelRemover) Filter(_ context.Context, metas map[ulid.ULID]*met

for _, replicaLabel := range r.replicaLabels {
if _, exists := l[replicaLabel]; exists {
level.Debug(r.logger).Log("msg", "replica label removed", "label", replicaLabel)
delete(l, replicaLabel)
countReplicaLabelRemoved[replicaLabel] += 1
modified.WithLabelValues(replicaRemovedMeta).Inc()
}
}
Expand All @@ -731,6 +732,9 @@ func (r *ReplicaLabelRemover) Filter(_ context.Context, metas map[ulid.ULID]*met
nm.Thanos.Labels = l
metas[u] = &nm
}
for replicaLabelRemoved, count := range countReplicaLabelRemoved {
level.Debug(r.logger).Log("msg", "removed replica label", "label", replicaLabelRemoved, "count", count)
}
return nil
}

Expand Down

0 comments on commit 84959bc

Please sign in to comment.