diff --git a/v3/integrations/nrgrpc/go.mod b/v3/integrations/nrgrpc/go.mod index 95611af41..04159bfc0 100644 --- a/v3/integrations/nrgrpc/go.mod +++ b/v3/integrations/nrgrpc/go.mod @@ -6,7 +6,7 @@ require ( // protobuf v1.3.0 is the earliest version using modules, we use v1.3.1 // because all dependencies were removed in this version. github.com/golang/protobuf v1.5.3 - github.com/newrelic/go-agent/v3 v3.28.1 + github.com/newrelic/go-agent/v3 v3.29.0 github.com/newrelic/go-agent/v3/integrations/nrsecurityagent v1.1.0 // v1.15.0 is the earliest version of grpc using modules. google.golang.org/grpc v1.56.3 diff --git a/v3/integrations/nrgrpc/nrgrpc_server.go b/v3/integrations/nrgrpc/nrgrpc_server.go index a0fab1866..8744f5380 100644 --- a/v3/integrations/nrgrpc/nrgrpc_server.go +++ b/v3/integrations/nrgrpc/nrgrpc_server.go @@ -43,6 +43,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" + "google.golang.org/grpc/peer" "google.golang.org/grpc/status" protoV2 "google.golang.org/protobuf/proto" ) @@ -62,13 +63,20 @@ func startTransaction(ctx context.Context, app *newrelic.Application, fullMethod target := hdrs.Get(":authority") url := getURL(method, target) + transport := newrelic.TransportHTTP + + p, ok := peer.FromContext(ctx) + if ok && p != nil && p.AuthInfo != nil && p.AuthInfo.AuthType() == "tls" { + transport = newrelic.TransportHTTPS + } webReq := newrelic.WebRequest{ - Header: hdrs, - URL: url, - Method: method, - Transport: newrelic.TransportHTTP, - Type: "gRPC", + Header: hdrs, + URL: url, + Method: method, + Transport: transport, + Type: "gRPC", + ServerName: target, } txn := app.StartTransaction(method) txn.SetWebRequest(webReq)