Documentation
¶
Overview ¶
Package tracing provides func to initialize opentracing tracer using jaeger client
Index ¶
- Constants
- func Close() error
- func Init(env string, cnf Config, zlog *zap.Logger) error
- func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor
- func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor
- type Class
- type Config
- type FilterFunc
- type OpNameFunc
- type Option
- type UnaryRequestHandlerFunc
Constants ¶
const ( // TagTraceID tag for trace id TagTraceID = "trace.traceid" // TagSpanID tag for span id TagSpanID = "trace.spanid" // TagSampled tag for sampled TagSampled = "trace.sampled" )
const ( // Component eg: GRPC Component = "component" // GRPCStatusCode status code GRPCStatusCode = "status.code" // GRPCResponseCode response code GRPCResponseCode = "response_code" // GRPCResponseClass response class GRPCResponseClass = "response_class" )
Variables ¶
This section is empty.
Functions ¶
func Init ¶
Init initialises opentracing tracer. Returns tracer for tracing spans & closer for flushing in-memory spans before app shutdown.
func StreamServerInterceptor ¶
func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor
StreamServerInterceptor returns a new streaming server interceptor for OpenTracing.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptor for OpenTracing.
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 Config ¶
type Config struct { LogSpans bool // when set to true, reporter logs all submitted spans Host string // jaeger-agent UDP binary thrift protocol endpoint Port string // jaeger-agent UDP binary thrift protocol server port ServiceName string // name of this service used by tracer. Disabled bool // to mock tracer }
Config ... struct expected by Init func to initialize jaeger tracing client.
type FilterFunc ¶
FilterFunc allows users to provide a function that filters out certain methods from being traced.
If it returns false, the given request will not be traced.
type OpNameFunc ¶
OpNameFunc is a func that allows custom operation names instead of the gRPC method.
type Option ¶
type Option func(*options)
Option accepts a fun with options
func WithFilterFunc ¶
func WithFilterFunc(f FilterFunc) Option
WithFilterFunc customizes the function used for deciding whether a given call is traced or not.
func WithOpName ¶
func WithOpName(f OpNameFunc) Option
WithOpName customizes the trace Operation name
func WithTraceHeaderName ¶
WithTraceHeaderName customizes the trace header name where trace metadata passed with requests. Default one is `uber-trace-id`
func WithTracer ¶
func WithTracer(tracer opentracing.Tracer) Option
WithTracer sets a custom tracer to be used for this middleware, otherwise the opentracing.GlobalTracer is used.
func WithUnaryRequestHandlerFunc ¶
func WithUnaryRequestHandlerFunc(f UnaryRequestHandlerFunc) Option
WithUnaryRequestHandlerFunc sets a custom handler for the request
type UnaryRequestHandlerFunc ¶
type UnaryRequestHandlerFunc func(span opentracing.Span, req interface{})
UnaryRequestHandlerFunc is a custom request handler