From 6bad20f15760a8a4186c38292acc11a1f50cba30 Mon Sep 17 00:00:00 2001 From: Ziqi Zhao Date: Fri, 22 Sep 2023 13:18:57 +0800 Subject: [PATCH 1/3] modify otelgrpc example to use stats.Handler Signed-off-by: Ziqi Zhao --- .../google.golang.org/grpc/otelgrpc/example/client/main.go | 3 +-- .../google.golang.org/grpc/otelgrpc/example/server/main.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/example/client/main.go b/instrumentation/google.golang.org/grpc/otelgrpc/example/client/main.go index 44963614ef5..5ef1227c62f 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/example/client/main.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/example/client/main.go @@ -44,8 +44,7 @@ func main() { var conn *grpc.ClientConn conn, err = grpc.Dial(":7777", grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithUnaryInterceptor(otelgrpc.UnaryClientInterceptor()), - grpc.WithStreamInterceptor(otelgrpc.StreamClientInterceptor()), + grpc.WithStatsHandler(otelgrpc.NewClientHandler()), ) if err != nil { diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/example/server/main.go b/instrumentation/google.golang.org/grpc/otelgrpc/example/server/main.go index f64266d98e5..000c1a78bb4 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/example/server/main.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/example/server/main.go @@ -140,8 +140,7 @@ func main() { } s := grpc.NewServer( - grpc.UnaryInterceptor(otelgrpc.UnaryServerInterceptor()), - grpc.StreamInterceptor(otelgrpc.StreamServerInterceptor()), + grpc.StatsHandler(otelgrpc.NewServerHandler()), ) api.RegisterHelloServiceServer(s, &server{}) From 0baa55ff231fc1b737e1c1de5293e0fbd641c299 Mon Sep 17 00:00:00 2001 From: Ziqi Zhao Date: Fri, 22 Sep 2023 13:38:49 +0800 Subject: [PATCH 2/3] add changelog Signed-off-by: Ziqi Zhao --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b149fa66d4..aa00b0c2ac3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Set the description for the `rpc.server.duration` metric in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc`. (#4302) - Add `NewServerHandler` and `NewClientHandler` that return a `grpc.StatsHandler` used for gRPC instrumentation in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc`. (#3002) +### Changed +- Update example to use `grpc.StatsHandler` for gRPC instrumentation in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/example`. (#4325) + ## [1.19.0/0.44.0/0.13.0] - 2023-09-12 ### Added From 1e702e88e1c5d7b63dda58bf773ea06de77a70a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 22 Sep 2023 10:10:26 +0200 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa00b0c2ac3..65a1ceafabc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `NewServerHandler` and `NewClientHandler` that return a `grpc.StatsHandler` used for gRPC instrumentation in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc`. (#3002) ### Changed -- Update example to use `grpc.StatsHandler` for gRPC instrumentation in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/example`. (#4325) + +- Use `grpc.StatsHandler` for gRPC instrumentation in `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/example`. (#4325) ## [1.19.0/0.44.0/0.13.0] - 2023-09-12