Skip to content

Commit

Permalink
remove usage of deprecated funcs
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
  • Loading branch information
codeboten committed Apr 12, 2024
1 parent d8b4057 commit f700af5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions config/configgrpc/configgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,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(ctx context.Context, host component.Host, settings component.TelemetrySettings, extraOpts ...grpc.DialOption) (*grpc.ClientConn, error) {
func (gcs *ClientConfig) ToClientConn(_ 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.DialContext(ctx, gcs.sanitizedEndpoint(), opts...)
return grpc.NewClient(gcs.sanitizedEndpoint(), opts...)
}

func (gcs *ClientConfig) toDialOptions(host component.Host, settings component.TelemetrySettings) ([]grpc.DialOption, error) {
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/internal/logs/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestExport_PermanentErrorConsumer(t *testing.T) {

func makeLogsServiceClient(t *testing.T, lc consumer.Logs) plogotlp.GRPCClient {
addr := otlpReceiverOnGRPCServer(t, lc)
cc, err := grpc.Dial(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
cc, err := grpc.NewClient(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
require.NoError(t, err, "Failed to create the TraceServiceClient: %v", err)
t.Cleanup(func() {
require.NoError(t, cc.Close())
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/internal/metrics/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestExport_PermanentErrorConsumer(t *testing.T) {
func makeMetricsServiceClient(t *testing.T, mc consumer.Metrics) pmetricotlp.GRPCClient {
addr := otlpReceiverOnGRPCServer(t, mc)

cc, err := grpc.Dial(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
cc, err := grpc.NewClient(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
require.NoError(t, err, "Failed to create the MetricsServiceClient: %v", err)
t.Cleanup(func() {
require.NoError(t, cc.Close())
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/internal/trace/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestExport_PermanentErrorConsumer(t *testing.T) {

func makeTraceServiceClient(t *testing.T, tc consumer.Traces) ptraceotlp.GRPCClient {
addr := otlpReceiverOnGRPCServer(t, tc)
cc, err := grpc.Dial(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
cc, err := grpc.NewClient(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
require.NoError(t, err, "Failed to create the TraceServiceClient: %v", err)
t.Cleanup(func() {
require.NoError(t, cc.Close())
Expand Down
8 changes: 4 additions & 4 deletions receiver/otlpreceiver/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ func TestOTLPReceiverGRPCTracesIngestTest(t *testing.T) {
require.NoError(t, recv.Start(context.Background(), componenttest.NewNopHost()))
t.Cleanup(func() { require.NoError(t, recv.Shutdown(context.Background())) })

cc, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
cc, err := grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
require.NoError(t, err)
defer func() {
assert.NoError(t, cc.Close())
Expand Down Expand Up @@ -722,7 +722,7 @@ func TestGRPCMaxRecvSize(t *testing.T) {
recv := newReceiver(t, componenttest.NewNopTelemetrySettings(), cfg, otlpReceiverID, sink)
require.NoError(t, recv.Start(context.Background(), componenttest.NewNopHost()))

cc, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
cc, err := grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
require.NoError(t, err)

td := testdata.GenerateTraces(50000)
Expand All @@ -735,7 +735,7 @@ func TestGRPCMaxRecvSize(t *testing.T) {
require.NoError(t, recv.Start(context.Background(), componenttest.NewNopHost()))
t.Cleanup(func() { require.NoError(t, recv.Shutdown(context.Background())) })

cc, err = grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
cc, err = grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
require.NoError(t, err)
defer func() {
assert.NoError(t, cc.Close())
Expand Down Expand Up @@ -1008,7 +1008,7 @@ func TestShutdown(t *testing.T) {
require.NotNil(t, r)
require.NoError(t, r.Start(context.Background(), componenttest.NewNopHost()))

conn, err := grpc.Dial(endpointGrpc, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
conn, err := grpc.NewClient(endpointGrpc, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
require.NoError(t, err)
t.Cleanup(func() {
require.NoError(t, conn.Close())
Expand Down

0 comments on commit f700af5

Please sign in to comment.