Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg: Use new grpc.NewClient over grpc.Dial #4676

Merged
merged 2 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .errcheck_excludes.txt

This file was deleted.

4 changes: 3 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ linters-settings:
- pkg: github.com/segmentio/parquet-go
desc: Use github.com/parquet-go/parquet-go instead
errcheck:
exclude: ./.errcheck_excludes.txt
exclude-functions:
- (github.com/go-kit/log.Logger).Log
- (hash.Hash).Write
goimports:
local-prefixes: github.com/parca-dev/parca
gofumpt:
Expand Down
2 changes: 1 addition & 1 deletion pkg/debuginfo/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestStore(t *testing.T) {
}
}()

conn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := grpc.NewClient(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)
defer conn.Close()

Expand Down
4 changes: 2 additions & 2 deletions pkg/parca/parca.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ func Run(ctx context.Context, logger log.Logger, reg *prometheus.Registry, flags
otelgrpc.WithPropagators(propagators),
)),
}
conn, err := grpc.Dial(flags.ProfileShareServer, opts...)
conn, err := grpc.NewClient(flags.ProfileShareServer, opts...)
if err != nil {
return fmt.Errorf("failed to create gRPC connection to ProfileShareServer: %s, %w", flags.ProfileShareServer, err)
}
Expand Down Expand Up @@ -720,7 +720,7 @@ func runForwarder(
}))
}

conn, err := grpc.Dial(flags.StoreAddress, opts...)
conn, err := grpc.NewClient(flags.StoreAddress, opts...)
if err != nil {
return fmt.Errorf("failed to create gRPC connection: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/parca/parca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import (
)

func getShareServerConn(t Testing) sharepb.ShareServiceClient {
conn, err := grpc.Dial("api.pprof.me:443", grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
conn, err := grpc.NewClient("api.pprof.me:443", grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
require.NoError(t, err)
return sharepb.NewShareServiceClient(conn)
}
Expand Down Expand Up @@ -86,7 +86,7 @@ func benchmarkSetup(ctx context.Context, b *testing.B) (profilestorepb.ProfileSt
var conn grpc.ClientConnInterface
err := backoff.Retry(func() error {
var err error
conn, err = grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err = grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
// b.Logf("failed to connect to parca: %v", err)
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/query/columnquery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import (
)

func getShareServerConn(t Testing) sharepb.ShareServiceClient {
conn, err := grpc.Dial("api.pprof.me:443", grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
conn, err := grpc.NewClient("api.pprof.me:443", grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
require.NoError(t, err)
return sharepb.NewShareServiceClient(conn)
}
Expand Down
Loading