diff --git a/otel/go.mod b/otel/go.mod index 4c81ea6..9595234 100644 --- a/otel/go.mod +++ b/otel/go.mod @@ -3,7 +3,7 @@ module github.com/purposeinplay/go-commons/otel go 1.22 require ( - github.com/purposeinplay/go-commons/grpc v0.0.26 + github.com/purposeinplay/go-commons/grpc v0.0.27 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/contrib/instrumentation/runtime v0.52.0 go.opentelemetry.io/otel v1.27.0 diff --git a/otel/go.sum b/otel/go.sum index 7621a8b..38602d9 100644 --- a/otel/go.sum +++ b/otel/go.sum @@ -108,8 +108,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/prometheus v0.52.1 h1:BrQ29YG+mzdGh8DgHPirHbeMGNqtL+INe0rqg7ttBJ4= github.com/prometheus/prometheus v0.52.1/go.mod h1:3z74cVsmVH0iXOR5QBjB7Pa6A0KJeEAK5A6UsmAFb1g= -github.com/purposeinplay/go-commons/grpc v0.0.26 h1:3nJgtmv12WdMxN0n7d//eTSqo5zxR1F0uAuqI5q4a0c= -github.com/purposeinplay/go-commons/grpc v0.0.26/go.mod h1:DxBaoZZIbBh0fcTym8KTG3GfVvIHHhn3qgtzZyW94o0= +github.com/purposeinplay/go-commons/grpc v0.0.27 h1:C2cixtgjQ5nzsmarlmLnOKOBQeRMCMfDDlucE4R1ZVw= +github.com/purposeinplay/go-commons/grpc v0.0.27/go.mod h1:ynY0Z5sJiOS0RxfEfVJYM+hh+3cNQMxW+DkG5gj6Im4= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po= diff --git a/otel/test/integration_test.go b/otel/test/integration_test.go index 0eb4a77..c0bd3bc 100644 --- a/otel/test/integration_test.go +++ b/otel/test/integration_test.go @@ -21,6 +21,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/test/bufconn" + "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" ) func TestTracer(t *testing.T) { @@ -130,17 +131,23 @@ func TestIntegration(t *testing.T) { } }) + logger, err := zap.NewDevelopment() + req.NoError(err) + greeterClient1 := greetpb.NewGreetServiceClient(conn1) grpcServer2, err := commonsgrpc.NewServer( commonsgrpc.WithGRPCListener(lis2), commonsgrpc.WithDebug(zap.NewExample(), true), commonsgrpc.WithOTEL(), + commonsgrpc.WithUnaryServerInterceptorLogger(logger), commonsgrpc.WithRegisterServerFunc(func(server *grpc.Server) { greetpb.RegisterGreetServiceServer(server, &greeterService{ greetFunc: func(ctx context.Context, req *greetpb.GreetRequest) (*greetpb.GreetResponse, error) { t.Log("greet func server 2") + ctxzap.Info(ctx, "zap log") + return greeterClient1.Greet(ctx, req) }, })