Skip to content

Commit d2f4a1e

Browse files
committed
Remove pointless timeout parameter from ingester Dial
grpc.WithTimeout() is documented to only do anything if grpc.WithBlock() also supplied, and we do not supply that. Even then, it puts a timeout on the Dial() operation, which is not what we want.
1 parent 73a2946 commit d2f4a1e

File tree

6 files changed

+9
-11
lines changed

6 files changed

+9
-11
lines changed

pkg/distributor/distributor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ type Config struct {
7979
CompressToIngester bool
8080

8181
// for testing
82-
ingesterClientFactory func(addr string, timeout time.Duration, withCompression bool) (client.IngesterClient, error)
82+
ingesterClientFactory func(addr string, withCompression bool) (client.IngesterClient, error)
8383
}
8484

8585
// RegisterFlags adds the flags required to config this to the given FlagSet
@@ -224,7 +224,7 @@ func (d *Distributor) getClientFor(ingester *ring.IngesterDesc) (client.Ingester
224224
return client, nil
225225
}
226226

227-
client, err := d.cfg.ingesterClientFactory(ingester.Addr, d.cfg.RemoteTimeout, d.cfg.CompressToIngester)
227+
client, err := d.cfg.ingesterClientFactory(ingester.Addr, d.cfg.CompressToIngester)
228228
if err != nil {
229229
return nil, err
230230
}

pkg/distributor/distributor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func TestDistributorPush(t *testing.T) {
165165
IngestionRateLimit: 10000,
166166
IngestionBurstSize: 10000,
167167

168-
ingesterClientFactory: func(addr string, _ time.Duration, _ bool) (client.IngesterClient, error) {
168+
ingesterClientFactory: func(addr string, _ bool) (client.IngesterClient, error) {
169169
return ingesters[addr], nil
170170
},
171171
}, ring)
@@ -305,7 +305,7 @@ func TestDistributorQuery(t *testing.T) {
305305
IngestionRateLimit: 10000,
306306
IngestionBurstSize: 10000,
307307

308-
ingesterClientFactory: func(addr string, _ time.Duration, _ bool) (client.IngesterClient, error) {
308+
ingesterClientFactory: func(addr string, _ bool) (client.IngesterClient, error) {
309309
return ingesters[addr], nil
310310
},
311311
}, ring)

pkg/ingester/client/client.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package client
22

33
import (
4-
"time"
5-
64
"github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
75
"github.com/mwitkow/go-grpc-middleware"
86
"github.com/opentracing/opentracing-go"
@@ -18,8 +16,8 @@ type closableIngesterClient struct {
1816
}
1917

2018
// MakeIngesterClient makes a new IngesterClient
21-
func MakeIngesterClient(addr string, timeout time.Duration, withCompression bool) (IngesterClient, error) {
22-
opts := []grpc.DialOption{grpc.WithTimeout(timeout),
19+
func MakeIngesterClient(addr string, withCompression bool) (IngesterClient, error) {
20+
opts := []grpc.DialOption{
2321
grpc.WithInsecure(),
2422
grpc.WithUnaryInterceptor(grpc_middleware.ChainUnaryClient(
2523
otgrpc.OpenTracingClientInterceptor(opentracing.GlobalTracer()),

pkg/ingester/ingester.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ type Config struct {
9090
infName string
9191
id string
9292
skipUnregister bool
93-
ingesterClientFactory func(addr string, timeout time.Duration, withCompression bool) (client.IngesterClient, error)
93+
ingesterClientFactory func(addr string, withCompression bool) (client.IngesterClient, error)
9494
KVClient ring.KVClient
9595
}
9696

pkg/ingester/ingester_lifecycle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ func (i *Ingester) transferChunks() error {
359359
}
360360

361361
level.Info(util.Logger).Log("msg", "sending chunks to ingester", "ingester", targetIngester.Addr)
362-
c, err := i.cfg.ingesterClientFactory(targetIngester.Addr, i.cfg.SearchPendingFor, false)
362+
c, err := i.cfg.ingesterClientFactory(targetIngester.Addr, false)
363363
if err != nil {
364364
return err
365365
}

pkg/ingester/ingester_lifecycle_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func TestIngesterTransfer(t *testing.T) {
118118
require.NoError(t, err)
119119

120120
// Let ing2 send chunks to ing1
121-
ing1.cfg.ingesterClientFactory = func(addr string, timeout time.Duration, _ bool) (client.IngesterClient, error) {
121+
ing1.cfg.ingesterClientFactory = func(addr string, _ bool) (client.IngesterClient, error) {
122122
return ingesterClientAdapater{
123123
ingester: ing2,
124124
}, nil

0 commit comments

Comments
 (0)