From 051238ecd8626c23f7867a4eac23795cded1c5fa Mon Sep 17 00:00:00 2001
From: Pavol Loffay
Date: Wed, 9 Jun 2021 10:51:48 +0200
Subject: [PATCH 1/3] Use withResolver API in gRPC reporter
Signed-off-by: Pavol Loffay
---
cmd/agent/app/reporter/grpc/builder.go | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/cmd/agent/app/reporter/grpc/builder.go b/cmd/agent/app/reporter/grpc/builder.go
index e228293ab31..ce88e02f18f 100644
--- a/cmd/agent/app/reporter/grpc/builder.go
+++ b/cmd/agent/app/reporter/grpc/builder.go
@@ -82,7 +82,8 @@ func (b *ConnBuilder) CreateConnection(logger *zap.Logger, mFactory metrics.Fact
return nil, errors.New("at least one collector hostPort address is required when resolver is not available")
}
if len(b.CollectorHostPorts) > 1 {
- r, _ := generateAndRegisterManualResolver()
+ r := manual.NewBuilderWithScheme(strconv.FormatInt(time.Now().UnixNano(), 36))
+ dialOptions = append(dialOptions, grpc.WithResolvers(r))
var resolvedAddrs []resolver.Address
for _, addr := range b.CollectorHostPorts {
resolvedAddrs = append(resolvedAddrs, resolver.Address{Addr: addr})
@@ -125,12 +126,3 @@ func (b *ConnBuilder) CreateConnection(logger *zap.Logger, mFactory metrics.Fact
return conn, nil
}
-
-// generateAndRegisterManualResolver was removed from grpc.
-// Copied here to keep behavior the same.
-func generateAndRegisterManualResolver() (*manual.Resolver, func()) {
- scheme := strconv.FormatInt(time.Now().UnixNano(), 36)
- r := manual.NewBuilderWithScheme(scheme)
- resolver.Register(r)
- return r, func() { resolver.UnregisterForTesting(scheme) }
-}
From 10cb56e7fa48f95bc42a996bf1130198020b270e Mon Sep 17 00:00:00 2001
From: Pavol Loffay
Date: Fri, 11 Jun 2021 10:00:04 +0200
Subject: [PATCH 2/3] Use manual
Signed-off-by: Pavol Loffay
---
cmd/agent/app/reporter/grpc/builder.go | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/cmd/agent/app/reporter/grpc/builder.go b/cmd/agent/app/reporter/grpc/builder.go
index ce88e02f18f..c1dc5e3fdae 100644
--- a/cmd/agent/app/reporter/grpc/builder.go
+++ b/cmd/agent/app/reporter/grpc/builder.go
@@ -18,10 +18,6 @@ import (
"context"
"errors"
"fmt"
- "strconv"
- "strings"
- "time"
-
grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
"github.com/uber/jaeger-lib/metrics"
"go.uber.org/zap"
@@ -30,6 +26,7 @@ import (
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
+ "strings"
"github.com/jaegertracing/jaeger/cmd/agent/app/reporter"
"github.com/jaegertracing/jaeger/pkg/config/tlscfg"
@@ -82,7 +79,7 @@ func (b *ConnBuilder) CreateConnection(logger *zap.Logger, mFactory metrics.Fact
return nil, errors.New("at least one collector hostPort address is required when resolver is not available")
}
if len(b.CollectorHostPorts) > 1 {
- r := manual.NewBuilderWithScheme(strconv.FormatInt(time.Now().UnixNano(), 36))
+ r := manual.NewBuilderWithScheme("jaeger_manual")
dialOptions = append(dialOptions, grpc.WithResolvers(r))
var resolvedAddrs []resolver.Address
for _, addr := range b.CollectorHostPorts {
From 1dfa582a19c142aecefaf160db47dea05d21ecd3 Mon Sep 17 00:00:00 2001
From: Pavol Loffay
Date: Fri, 11 Jun 2021 19:00:05 +0200
Subject: [PATCH 3/3] fmt
Signed-off-by: Pavol Loffay
---
cmd/agent/app/reporter/grpc/builder.go | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cmd/agent/app/reporter/grpc/builder.go b/cmd/agent/app/reporter/grpc/builder.go
index c1dc5e3fdae..58e83fdd449 100644
--- a/cmd/agent/app/reporter/grpc/builder.go
+++ b/cmd/agent/app/reporter/grpc/builder.go
@@ -18,6 +18,8 @@ import (
"context"
"errors"
"fmt"
+ "strings"
+
grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
"github.com/uber/jaeger-lib/metrics"
"go.uber.org/zap"
@@ -26,7 +28,6 @@ import (
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/resolver/manual"
- "strings"
"github.com/jaegertracing/jaeger/cmd/agent/app/reporter"
"github.com/jaegertracing/jaeger/pkg/config/tlscfg"