Documentation ¶
Overview ¶
Library for tracing gRPC client/server interactions via AWS X-Ray
Index ¶
Constants ¶
const ( GrpcMethod = "POST" CustomUserAgent = "Vendrive-gRPC-XRAY-Interceptor" )
Variables ¶
This section is empty.
Functions ¶
func NewGrpcXrayUnaryClientInterceptor ¶
func NewGrpcXrayUnaryClientInterceptor(hostFromTarget func(string) string) grpc.UnaryClientInterceptor
Returns a UnaryClientInterceptor that supports populating gRPC metadata with AWS X-Ray information. Parameter hostFromTarget allows you to translate the grpc.ClientConn target into your preferred outbound server name. DNS Information, URL, gRPC error codes, and Content Length are currently not supported. Usage:
customHostFromTarget = func (target string) string { withoutPort := target[:strings.IndexByte(target, ':')] return strings.ReplaceAll(withoutPort, ".my-namespace.local", "") }
conn, err := grpc.Dial("my-service.my-namespace.local:3000",
grpc.WithInsecure(), grpc.WithUnaryInterceptor(xray_grpc.NewGrpcXrayUnaryClientInterceptor(customHostFromTarget)))
func NewGrpcXrayUnaryServerInterceptor ¶
func NewGrpcXrayUnaryServerInterceptor(sn xray.SegmentNamer) grpc.UnaryServerInterceptor
Returns a UnaryServerInterceptor that supports reading gRPC metadata that contains AWS X-Ray information. Intended to recieve requests from a gRPC client that uses NewGrpcXrayUnaryClientInterceptor. Currently only supports NewFixedSegmentNamer for parameter sn. Populating URL, gRPC error codes, and Content Length in segments are currently not supported. Usage:
s := grpc.NewServer(grpc.UnaryInterceptor(xray_grpc.NewGrpcXrayUnaryServerInterceptor(xray.NewFixedSegmentNamer("my-service"))))
Types ¶
This section is empty.