Skip to content

Commit

Permalink
Receiver: Fix labels debug logging in writer (thanos-io#5642)
Browse files Browse the repository at this point in the history
* Fix labels debug logging

Signed-off-by: Matej Gera <matejgera@gmail.com>

* Update CHANGELOG

Signed-off-by: Matej Gera <matejgera@gmail.com>

Signed-off-by: Matej Gera <matejgera@gmail.com>
Signed-off-by: Prakul Jain <prakul.jain@udaan.com>
  • Loading branch information
matej-g authored and prajain12 committed Sep 6, 2022
1 parent 90bce3e commit 554b2e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#5534](https://github.com/thanos-io/thanos/pull/5534) Query: Set struct return by query api alerts same as prometheus api.
- [#5554](https://github.com/thanos-io/thanos/pull/5554) Query/Receiver: Fix querying exemplars from multi-tenant receivers.
- [#5583](https://github.com/thanos-io/thanos/pull/5583) Query: fix data race between Respond() and query/queryRange functions. Fixes [#5410](https://github.com/thanos-io/thanos/pull/5410).
- [#5642](https://github.com/thanos-io/thanos/pull/5642) Receive: Log labels correctly in writer debug messages.

### Added

Expand Down
7 changes: 4 additions & 3 deletions pkg/receive/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,17 @@ func (r *Writer) Write(ctx context.Context, tenantID string, wreq *prompb.WriteR
// Check if time series labels are valid. If not, skip the time series
// and report the error.
if err := labelpb.ValidateLabels(t.Labels); err != nil {
lset := &labelpb.ZLabelSet{Labels: t.Labels}
switch err {
case labelpb.ErrOutOfOrderLabels:
numLabelsOutOfOrder++
level.Debug(tLogger).Log("msg", "Out of order labels in the label set", "lset", t.Labels)
level.Debug(tLogger).Log("msg", "Out of order labels in the label set", "lset", lset.String())
case labelpb.ErrDuplicateLabels:
numLabelsDuplicates++
level.Debug(tLogger).Log("msg", "Duplicate labels in the label set", "lset", t.Labels)
level.Debug(tLogger).Log("msg", "Duplicate labels in the label set", "lset", lset.String())
case labelpb.ErrEmptyLabels:
numLabelsEmpty++
level.Debug(tLogger).Log("msg", "Labels with empty name in the label set", "lset", t.Labels)
level.Debug(tLogger).Log("msg", "Labels with empty name in the label set", "lset", lset.String())
default:
level.Debug(tLogger).Log("msg", "Error validating labels", "err", err)
}
Expand Down

0 comments on commit 554b2e1

Please sign in to comment.