Skip to content

Commit

Permalink
ENG-48179: Revert to use DialContext in grpc client
Browse files Browse the repository at this point in the history
With NewClient API usage, we are facing issues at
few customers who have intermediate proxies between collector
and platform. With NewClient API instead Dial,
DNS resolution happens on the client side while it should happen on proxy.
Also, with SGProxy client does not get the correct certificate.
This can be changed once grpc fixes grpc/grpc-go#7556 and otel collector picks the fix
  • Loading branch information
puneet-traceable committed Sep 18, 2024
1 parent 9af37d4 commit 432b1c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion FORK.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ git push --tags
- In `config/configgrpc/configgrpc.go` we added the ability to add extra `ClientDialOptionHandler`. Also a unit test for this in `config/configgrpc/configgrpcclientdialoptionhandler_test.go`. Also commented out warning on servers starting `UnspecifiedHost` aka `0.0.0.0`.
- In `config/configgrpc/configgrpc_test.go` we commented a unit test checking for a warning on servers starting `UnspecifiedHost` aka `0.0.0.0`.
- In `config/confighttp/confighttp.go` we commented out warning on servers starting `UnspecifiedHost`.
- In ` config/confighttp/confighttp_test.go` we commented a unit test checking for a warning on servers starting `UnspecifiedHost`.
- In `config/confighttp/confighttp_test.go` we commented a unit test checking for a warning on servers starting `UnspecifiedHost`.
- In `config/configgrpc/configgrpc.go` we reverted back to use `grpc.DialContext` method instead of `grpc.NewClient`
4 changes: 2 additions & 2 deletions config/configgrpc/configgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ func (gcs *ClientConfig) isSchemeHTTPS() bool {
// a non-blocking dial (the function won't wait for connections to be
// established, and connecting happens in the background). To make it a blocking
// dial, use grpc.WithBlock() dial option.
func (gcs *ClientConfig) ToClientConn(_ context.Context, host component.Host, settings component.TelemetrySettings, extraOpts ...grpc.DialOption) (*grpc.ClientConn, error) {
func (gcs *ClientConfig) ToClientConn(ctx context.Context, host component.Host, settings component.TelemetrySettings, extraOpts ...grpc.DialOption) (*grpc.ClientConn, error) {
opts, err := gcs.toDialOptions(host, settings)
if err != nil {
return nil, err
}
opts = append(opts, extraOpts...)
return grpc.NewClient(gcs.sanitizedEndpoint(), opts...)
return grpc.DialContext(ctx, gcs.sanitizedEndpoint(), opts...)
}

func (gcs *ClientConfig) toDialOptions(host component.Host, settings component.TelemetrySettings) ([]grpc.DialOption, error) {
Expand Down

0 comments on commit 432b1c0

Please sign in to comment.