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

grpc: do not use deprecated APIs in example code #2855

Closed
wants to merge 2 commits into from
Closed
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
12 changes: 7 additions & 5 deletions contrib/google.golang.org/grpc/example_test.go
Original file line number Diff line number Diff line change
@@ -12,18 +12,20 @@ import (
grpctrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/google.golang.org/grpc"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)

func Example_client() {
// Create the client interceptor using the grpc trace package.
si := grpctrace.StreamClientInterceptor(grpctrace.WithServiceName("my-grpc-client"))
ui := grpctrace.UnaryClientInterceptor(grpctrace.WithServiceName("my-grpc-client"))

// Dial in using the created interceptor.
// Note: To use multiple UnaryInterceptors with grpc.Dial, you must use
// grpc.WithChainUnaryInterceptor instead (as of google.golang.org/grpc v1.51.0).
conn, err := grpc.Dial("localhost:50051", grpc.WithInsecure(),
grpc.WithStreamInterceptor(si), grpc.WithUnaryInterceptor(ui))
conn, err := grpc.NewClient(
"localhost:50051",
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithStreamInterceptor(si),
grpc.WithUnaryInterceptor(ui),
)
if err != nil {
log.Fatal(err)
}
33 changes: 16 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ require (
github.com/gofiber/fiber/v2 v2.52.5
github.com/gomodule/redigo v1.8.9
github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b
github.com/google/uuid v1.5.0
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.0
github.com/graph-gophers/graphql-go v1.5.0
github.com/graphql-go/graphql v0.8.1
@@ -94,14 +94,14 @@ require (
go.opentelemetry.io/otel v1.20.0
go.opentelemetry.io/otel/trace v1.20.0
go.uber.org/atomic v1.11.0
golang.org/x/mod v0.14.0
golang.org/x/oauth2 v0.9.0
golang.org/x/sys v0.20.0
golang.org/x/mod v0.17.0
golang.org/x/oauth2 v0.21.0
golang.org/x/sys v0.21.0
golang.org/x/time v0.3.0
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028
google.golang.org/api v0.128.0
google.golang.org/grpc v1.57.1
google.golang.org/protobuf v1.33.0
google.golang.org/grpc v1.66.1
google.golang.org/protobuf v1.34.1
gopkg.in/jinzhu/gorm.v1 v1.9.2
gopkg.in/olivere/elastic.v3 v3.0.75
gopkg.in/olivere/elastic.v5 v5.0.84
@@ -116,8 +116,7 @@ require (

require (
cloud.google.com/go v0.110.7 // indirect
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v1.1.2 // indirect
github.com/DataDog/go-tuf v1.0.2-0.5.2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
@@ -141,7 +140,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/sts v1.18.9 // indirect
github.com/bytedance/sonic v1.10.0 // indirect
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
@@ -256,17 +255,17 @@ require (
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel/metric v1.20.0 // indirect
golang.org/x/arch v0.4.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.16.1 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Loading