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

Upgrade cobra, viper, grpc to latest #4586

Merged
merged 1 commit into from
Dec 20, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions cmd/builder/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ module go.opentelemetry.io/collector/cmd/builder
go 1.17

require (
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.9.0
github.com/spf13/cobra v1.3.0
github.com/spf13/viper v1.10.1
github.com/stretchr/testify v1.7.0
go.uber.org/zap v1.19.1
)
Expand All @@ -29,7 +29,7 @@ require (
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mitchellh/mapstructure v1.4.2 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -40,9 +40,9 @@ require (
github.com/subosito/gotenv v1.2.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect
golang.org/x/text v0.3.6 // indirect
gopkg.in/ini.v1 v1.63.2 // indirect
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
192 changes: 144 additions & 48 deletions cmd/builder/go.sum

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions config/configgrpc/configgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/balancer/roundrobin"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/encoding/gzip"
"google.golang.org/grpc/keepalive"
"google.golang.org/grpc/metadata"
Expand Down Expand Up @@ -205,13 +206,13 @@ func (gcs *GRPCClientSettings) ToDialOptions(host component.Host, settings compo
if err != nil {
return nil, err
}
tlsDialOption := grpc.WithInsecure()
cred := insecure.NewCredentials()
if tlsCfg != nil {
tlsDialOption = grpc.WithTransportCredentials(credentials.NewTLS(tlsCfg))
cred = credentials.NewTLS(tlsCfg)
} else if gcs.isSchemeHTTPS() {
tlsDialOption = grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{}))
cred = credentials.NewTLS(&tls.Config{})
}
opts = append(opts, tlsDialOption)
opts = append(opts, grpc.WithTransportCredentials(cred))

if gcs.ReadBufferSize > 0 {
opts = append(opts, grpc.WithReadBufferSize(gcs.ReadBufferSize))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require (
go.uber.org/zap v1.19.1
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa
google.golang.org/grpc v1.42.0
google.golang.org/grpc v1.43.0
google.golang.org/protobuf v1.27.1
gopkg.in/yaml.v2 v2.4.0
)
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,9 @@ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnD
google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A=
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM=
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
Expand Down
3 changes: 2 additions & 1 deletion receiver/otlpreceiver/internal/logs/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config"
Expand Down Expand Up @@ -91,7 +92,7 @@ func TestExport_ErrorConsumer(t *testing.T) {
}

func makeLogsServiceClient(addr net.Addr) (otlpgrpc.LogsClient, func(), error) {
cc, err := grpc.Dial(addr.String(), grpc.WithInsecure(), grpc.WithBlock())
cc, err := grpc.Dial(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
if err != nil {
return nil, nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion receiver/otlpreceiver/internal/metrics/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config"
Expand Down Expand Up @@ -93,7 +94,7 @@ func TestExport_ErrorConsumer(t *testing.T) {
}

func makeMetricsServiceClient(addr net.Addr) (otlpgrpc.MetricsClient, func(), error) {
cc, err := grpc.Dial(addr.String(), grpc.WithInsecure(), grpc.WithBlock())
cc, err := grpc.Dial(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
if err != nil {
return nil, nil, err
}
Expand Down
3 changes: 2 additions & 1 deletion receiver/otlpreceiver/internal/trace/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config"
Expand Down Expand Up @@ -90,7 +91,7 @@ func TestExport_ErrorConsumer(t *testing.T) {
}

func makeTraceServiceClient(addr net.Addr) (otlpgrpc.TracesClient, func(), error) {
cc, err := grpc.Dial(addr.String(), grpc.WithInsecure(), grpc.WithBlock())
cc, err := grpc.Dial(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
if err != nil {
return nil, nil, err
}
Expand Down
9 changes: 5 additions & 4 deletions receiver/otlpreceiver/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
spb "google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"

Expand Down Expand Up @@ -506,7 +507,7 @@ func TestOTLPReceiverTrace_HandleNextConsumerResponse(t *testing.T) {
require.NoError(t, ocr.Start(context.Background(), componenttest.NewNopHost()))
t.Cleanup(func() { require.NoError(t, ocr.Shutdown(context.Background())) })

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

Expand Down Expand Up @@ -576,7 +577,7 @@ func TestGRPCMaxRecvSize(t *testing.T) {
require.NotNil(t, ocr)
require.NoError(t, ocr.Start(context.Background(), componenttest.NewNopHost()))

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

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

cc, err = grpc.Dial(addr, grpc.WithInsecure(), grpc.WithBlock())
cc, err = grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
require.NoError(t, err)
defer cc.Close()

Expand Down Expand Up @@ -698,7 +699,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.WithInsecure(), grpc.WithBlock())
conn, err := grpc.Dial(endpointGrpc, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
require.NoError(t, err)
defer conn.Close()

Expand Down