Documentation ¶
Overview ¶
Package tracing provide tracing feature for GRPC.
Refer to: opentelemetry-go-contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go
Index ¶
- Constants
- func Extract(ctx context.Context, metadata metadata.MD) (baggage.Baggage, trace.SpanContext)
- func Inject(ctx context.Context, metadata metadata.MD)
- func StreamClientInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, ...) (grpc.ClientStream, error)
- func StreamServerInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func UnaryClientInterceptor(ctx context.Context, method string, req, reply interface{}, ...) error
- func UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
Constants ¶
const ( // GRPCStatusCodeKey is convention for numeric status code of a gRPC request. GRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") )
Variables ¶
This section is empty.
Functions ¶
func Extract ¶
Extract returns the correlation context and span context that another service encoded in the gRPC metadata object with Inject. This function is meant to be used on incoming requests.
func Inject ¶
Inject injects correlation context and span context into the gRPC metadata object. This function is meant to be used on outgoing requests.
func StreamClientInterceptor ¶
func StreamClientInterceptor( ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, callOpts ...grpc.CallOption) (grpc.ClientStream, error)
StreamClientInterceptor returns a grpc.StreamClientInterceptor suitable for use in a grpc.Dial call.
func StreamServerInterceptor ¶
func StreamServerInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
StreamServerInterceptor returns a grpc.StreamServerInterceptor suitable for use in a grpc.NewServer call.
func UnaryClientInterceptor ¶
func UnaryClientInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, callOpts ...grpc.CallOption) error
UnaryClientInterceptor returns a grpc.UnaryClientInterceptor suitable for use in a grpc.Dial call.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
UnaryServerInterceptor returns a grpc.UnaryServerInterceptor suitable for use in a grpc.NewServer call.
Types ¶
This section is empty.