Documentation ¶
Index ¶
- func ClientCaptureException(repanic bool) grpc.UnaryClientInterceptor
- func ServerCaptureException(repanic bool) grpc.UnaryServerInterceptor
- func TracingClientInterceptor(optFuncs ...Option) grpc.UnaryClientInterceptor
- func TracingServerInterceptor(optFuncs ...Option) grpc.UnaryServerInterceptor
- type Option
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientCaptureException ¶
func ClientCaptureException(repanic bool) grpc.UnaryClientInterceptor
ClientCaptureException 用于辅助 open telemetry 采集应用错误和异常信息 因此必须在 ClientTracing 之后调用
func ServerCaptureException ¶
func ServerCaptureException(repanic bool) grpc.UnaryServerInterceptor
ServerCaptureException 用于辅助 open telemetry 采集应用错误和异常信息 因此必须在 ServerTracing 之后调用
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 TraceContext 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" tracinggrpc "github.com/yeqown/opentelemetry-quake/contrib/grpc" ) func main() { address := "dns:///xxx" conn, err := grpc.Dial( address, grpc.WithUnaryInterceptor(tracinggrpc.TracingClientInterceptor(tracinggrpc.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 TraceContext in the gRPC metadata; if found, the server span will act as the ChildOf that RPC TraceContext.
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" tracinggrpc "github.com/yeqown/opentelemetry-quake/contrib/grpc" ) func main() { s := grpc.NewServer( grpc.UnaryInterceptor(tracinggrpc.TracingServerInterceptor( tracinggrpc.LogPayloads(), )), ) _ = s }
Output:
Types ¶
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.