Skip to content

Commit

Permalink
Address CR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
  • Loading branch information
fpetkovski committed Aug 1, 2022
1 parent 1bbd985 commit bcf14f6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 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
12 changes: 5 additions & 7 deletions pkg/exemplars/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,18 @@ import (
"sync"
"testing"

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

"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"
"github.com/thanos-io/thanos/pkg/testutil"
"go.uber.org/atomic"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)

type testExemplarClient struct {
Expand Down

0 comments on commit bcf14f6

Please sign in to comment.