Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TracingClientInterceptor ¶
func TracingClientInterceptor(optFuncs ...Option) grpc.UnaryClientInterceptor
TracingClientInterceptor returns a grpc.UnaryClientInterceptor suitable for use in a grpc.Dial call.
All gRPC client spans will inject the OpenTracing SpanContext into the gRPC metadata; they will also look in the context.Context for an active in-process parent Span and establish a ChildOf reference if such a parent Span could be found.
Example ¶
package main import ( "google.golang.org/grpc" otelgrpc "github.com/yeqown/opentelemetry-quake/x/grpc" ) func main() { address := "dns:///xxx" conn, err := grpc.Dial( address, grpc.WithUnaryInterceptor(otelgrpc.TracingClientInterceptor(otelgrpc.LogPayloads())), ) _, _ = conn, err }
Output:
func TracingServerInterceptor ¶
func TracingServerInterceptor(optFuncs ...Option) grpc.UnaryServerInterceptor
TracingServerInterceptor returns a grpc.UnaryServerInterceptor suitable for use in a grpc.NewServer call.
All gRPC server spans will look for an OpenTracing SpanContext in the gRPC metadata; if found, the server span will act as the ChildOf that RPC SpanContext.
Root or not, the server Span will be embedded in the context.Context for the application-specific gRPC handler(s) to access.
Example ¶
package main import ( "google.golang.org/grpc" otelgrpc "github.com/yeqown/opentelemetry-quake/x/grpc" ) func main() { s := grpc.NewServer( grpc.UnaryInterceptor(otelgrpc.TracingServerInterceptor( otelgrpc.LogPayloads(), )), ) _ = s }
Output:
Types ¶
type Class ¶
type Class string
A Class is a set of types of outcomes (including errors) that will often be handled in the same way.
type Option ¶
type Option func(o *options)
Option instances may be used in OpenTracing(Server|Client)Interceptor initialization.
See this post about the "functional options" pattern: http://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
func LogPayloads ¶
func LogPayloads() Option
LogPayloads returns an Option that tells the OpenTracing instrumentation to try to log application payloads in both directions.