Skip to content

Commit

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

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Reduce amount of removed replica label instead of removing it

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

* Reformat code

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>

---------

Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
  • Loading branch information
douglascamata authored and Nathaniel Graham committed Apr 17, 2023
1 parent 94e53ee commit 132d438
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 132d438

Please sign in to comment.