Skip to content

Commit

Permalink
do not use deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
keisku committed Sep 11, 2024
1 parent 0ffa615 commit 6577faf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions contrib/google.golang.org/grpc/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(

Check failure on line 23 in contrib/google.golang.org/grpc/example_test.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests / test-contrib

undefined: grpc.NewClient

Check failure on line 23 in contrib/google.golang.org/grpc/example_test.go

View workflow job for this annotation

GitHub Actions / PR Unit and Integration Tests / test-contrib

undefined: grpc.NewClient
"localhost:50051",
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithStreamInterceptor(si),
grpc.WithUnaryInterceptor(ui),
)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 6577faf

Please sign in to comment.