Skip to content

Commit

Permalink
Address CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fpetkovski committed Aug 1, 2022
1 parent f9c63ed commit 547eb06
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
### Fixed
- [#5502](https://github.com/thanos-io/thanos/pull/5502) Receive: Handle exemplar storage errors as conflict error.
- [#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/5534) Query/Receiver: Fix querying exemplars from multi-tenant receivers.
- [#5554](https://github.com/thanos-io/thanos/pull/5554) Query/Receiver: Fix querying exemplars from multi-tenant receivers.

### Added

Expand Down
10 changes: 6 additions & 4 deletions pkg/exemplars/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ func (s *Proxy) Exemplars(req *exemplarspb.ExemplarsRequest, srv exemplarspb.Exe
exemplars []*exemplarspb.ExemplarData
)

queryParts := make([]string, 0)
labelMatchers := make([]string, 0)
for _, st := range s.exemplars() {
var queryParts []string
queryParts = queryParts[:0]

Matchers:
for _, matchers := range selectors {
Expand All @@ -102,12 +104,12 @@ func (s *Proxy) Exemplars(req *exemplarspb.ExemplarsRequest, srv exemplarspb.Exe
}
}

matchers := make([]string, 0, len(matcherSet))
labelMatchers = labelMatchers[:0]
for m := range matcherSet {
matchers = append(matchers, m)
labelMatchers = append(labelMatchers, m)
}

queryParts = append(queryParts, "{"+strings.Join(matchers, ", ")+"}")
queryParts = append(queryParts, "{"+strings.Join(labelMatchers, ", ")+"}")
}

// No matchers match this store.
Expand Down
8 changes: 4 additions & 4 deletions pkg/exemplars/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import (
"sync"
"testing"

"github.com/prometheus/prometheus/promql/parser"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"go.uber.org/atomic"

"github.com/go-kit/log"
"github.com/pkg/errors"
"github.com/prometheus/prometheus/model/labels"
"go.uber.org/atomic"
"google.golang.org/grpc"

"github.com/prometheus/prometheus/promql/parser"
"github.com/thanos-io/thanos/pkg/exemplars/exemplarspb"
"github.com/thanos-io/thanos/pkg/store/labelpb"
"github.com/thanos-io/thanos/pkg/store/storepb"
Expand Down

0 comments on commit 547eb06

Please sign in to comment.