Skip to content

Commit 49d3d3f

Browse files
committed
fix test
Signed-off-by: alanprot <[email protected]>
1 parent 9817d07 commit 49d3d3f

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

pkg/compactor/shuffle_sharding_grouper_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,10 @@ type RingMock struct {
747747
mock.Mock
748748
}
749749

750+
func (r *RingMock) GetInstanceIdByAddr(addr string) (string, error) {
751+
return "", nil
752+
}
753+
750754
func (r *RingMock) Collect(ch chan<- prometheus.Metric) {}
751755

752756
func (r *RingMock) Describe(ch chan<- *prometheus.Desc) {}

pkg/distributor/query.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package distributor
22

33
import (
44
"context"
5-
"github.com/go-kit/log/level"
65
"io"
76
"sort"
87
"time"
98

9+
"github.com/go-kit/log/level"
1010
"github.com/opentracing/opentracing-go"
1111
"github.com/prometheus/common/model"
1212
"github.com/prometheus/prometheus/model/labels"
@@ -166,12 +166,13 @@ func (d *Distributor) queryIngestersExemplars(ctx context.Context, replicationSe
166166
return nil, err
167167
}
168168

169-
resp, err := client.(ingester_client.IngesterClient).QueryExemplars(ctx, req)
170169
ingesterId, err := d.ingestersRing.GetInstanceIdByAddr(ing.Addr)
171170
if err != nil {
172171
level.Warn(d.log).Log("msg", "instance not found in the ring", "addr", ing.Addr, "err", err)
173172
}
174173

174+
resp, err := client.(ingester_client.IngesterClient).QueryExemplars(ctx, req)
175+
175176
d.ingesterQueries.WithLabelValues(ingesterId).Inc()
176177
if err != nil {
177178
d.ingesterQueryFailures.WithLabelValues(ingesterId).Inc()

pkg/ring/util_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ type RingMock struct {
1717
mock.Mock
1818
}
1919

20+
func (r *RingMock) GetInstanceIdByAddr(addr string) (string, error) {
21+
return "", nil
22+
}
23+
2024
func (r *RingMock) Collect(ch chan<- prometheus.Metric) {}
2125

2226
func (r *RingMock) Describe(ch chan<- *prometheus.Desc) {}

0 commit comments

Comments
 (0)