proxy.golang.org : github.com/newrelic/go-agent/v3/integrations/nrgrpc : v1.4.2
Package nrgrpc instruments https://github.com/grpc/grpc-go. This package can be used to instrument gRPC servers and gRPC clients. To instrument a gRPC server, use UnaryServerInterceptor and StreamServerInterceptor with your newrelic.Application to create server interceptors to pass to grpc.NewServer. The results of these calls are reported as errors or as informational messages (of levels OK, Info, Warning, or Error) based on the gRPC status code they return. In the simplest case, simply add interceptors as in the following example: The disposition of each, in terms of how to report each of the various gRPC status codes, is determined by a built-in set of defaults: These may be overridden on a case-by-case basis using `WithStatusHandler()` options to each `UnaryServerInterceptor()` or `StreamServerInterceptor()` call, or globally via the `Configure()` function. For example, to report DeadlineExceeded as an error and NotFound as a warning, for the UnaryInterceptor only: If you wanted to make those two changes to the overall default behavior, so they apply to all subsequently declared interceptors: In this case the new behavior for those two status codes applies to both interceptors. These interceptors create transactions for inbound calls. The transaction is added to the call context and can be accessed in your method handlers using newrelic.FromContext. Full server example: https://github.com/newrelic/go-agent/blob/master/v3/integrations/nrgrpc/example/server/server.go To instrument a gRPC client, follow these two steps: 1. Use UnaryClientInterceptor and StreamClientInterceptor when creating a grpc.ClientConn. Example: 2. Ensure that calls made with this grpc.ClientConn are done with a context which contains a newrelic.Transaction. Full client example: https://github.com/newrelic/go-agent/blob/master/v3/integrations/nrgrpc/example/client/client.go
Registry -
Documentation -
Download -
JSON -
codemeta.json
purl: pkg:golang/github.com/newrelic/go-agent/v3/integrations/nrgrpc@v1.4.2
Published:
Indexed:
- ../.. *
- ../../integrations/nrsecurityagent *
- github.com/golang/protobuf v1.5.3
- google.golang.org/grpc v1.56.3
- google.golang.org/protobuf v1.30.0