Documentation ¶
Index ¶
- Constants
- Variables
- func ClientInterceptor() grpc.UnaryClientInterceptor
- func Close() error
- func ContextFromString(xid string) (jaeger.SpanContext, error)
- func ContextWithSpan(ctx context.Context, span opentracing.Span) context.Context
- func ExtractGrpcHeader(ctx context.Context) (opentracing.SpanContext, error)
- func ExtractHttpHeader(header http.Header) (opentracing.SpanContext, error)
- func GetCaller() string
- func GetCallerCache() string
- func GetFullTraceID(span opentracing.Span) string
- func GetFunc(ns ...int) string
- func GetFuncSkip(skip int) string
- func GetParentID(span opentracing.Span) string
- func GetSpanID(span opentracing.Span) string
- func GetSpanIDFromCtx(ctx context.Context) string
- func GetTraceID(span opentracing.Span) string
- func GetTraceIDFromCtx(ctx context.Context) string
- func GetTraceSpanIDs(span opentracing.Span) (string, string)
- func GetTraceSpanIDsFromCtx(ctx context.Context) (string, string)
- func GetTracer() opentracing.Tracer
- func GetXTraceID(span opentracing.Span) string
- func GrpcDialOption() grpc.DialOption
- func GrpcSendHeader(ctx context.Context, header metadata.MD)
- func GrpcServerOption() grpc.ServerOption
- func InjectGrpcMD(span opentracing.Span, header metadata.MD, ctx context.Context) (context.Context, metadata.MD)
- func InjectHttpHeader(span opentracing.Span, header http.Header) error
- func MakeFullTraceID() string
- func MakeRandomNumber() uint64
- func MockID() string
- func NewHttpSender(url string) jaeger.Transport
- func NewRand(seed int64) *rand.Rand
- func NewRedisHook(tracer opentracing.Tracer) redis.Hook
- func NewTracer(serviceName string, addr string, fns ...optionFunc) (opentracing.Tracer, io.Closer, error)
- func NewTracerWithConfig(cfg *Config) (opentracing.Tracer, io.Closer, error)
- func ServerInterceptor() grpc.UnaryServerInterceptor
- func SeteTracer(otracer opentracing.Tracer)
- func SpanFromContext(ctx context.Context) opentracing.Span
- func SpanFromString(operation, xid string) (opentracing.Span, error)
- func StartSpan(operation string, opts ...opentracing.StartSpanOption) opentracing.Span
- func StartSpanContext(operation string, opts ...opentracing.StartSpanOption) (context.Context, opentracing.Span)
- func StartSpanFromContext(ctx context.Context, operation string) (opentracing.Span, context.Context)
- func StartSpanFromContextExt(ctx context.Context, fname string, request, response interface{}) (opentracing.Span, context.Context, func())
- func StartSpanFromGinContext(ctx *gin.Context, fname string, request, response interface{}) (opentracing.Span, context.Context, func())
- func TracingMiddleware(name string) gin.HandlerFunc
- func WithFlushInterval(ms int) optionFunc
- func WithMaxTagLength(size int) optionFunc
- func WithProtoKind(kind int) optionFunc
- func WithQueueSize(size int) optionFunc
- func WithReporter(cfg *jaegercfg.ReporterConfig) optionFunc
- func WithSampler(sampler *jaegercfg.SamplerConfig) optionFunc
- func WithSender(sender jaeger.Transport) optionFunc
- type Config
- type MetadataHeader
- type Option
- type RedisTracingHook
- func (hook RedisTracingHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error
- func (hook RedisTracingHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
- func (hook RedisTracingHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)
- func (hook RedisTracingHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)
- type Span
- func (sp *Span) End()
- func (sp *Span) LogError(err error) *Span
- func (sp *Span) LogFields(fields ...log.Field) *Span
- func (sp *Span) LogKV(key string, val interface{}) *Span
- func (sp *Span) LogObject(key string, obj interface{}) *Span
- func (sp *Span) LogString(key, val string) *Span
- func (sp *Span) SetTag(key string, val interface{}) *Span
- func (sp *Span) Start(ctx context.Context, operation string) (context.Context, *Span)
- type SpanEntry
Constants ¶
const ( HeaderTraceID = "trace-id" HeaderSpanID = "span-id" HeaderXTraceID = "x-trace-id" )
Variables ¶
Functions ¶
func ClientInterceptor ¶
func ClientInterceptor() grpc.UnaryClientInterceptor
ClientInterceptor grpc client wrapper
func ContextFromString ¶
ContextFromString build context by x-trace-id
func ContextWithSpan ¶
ContextWithSpan returns a new `context.Context` that holds a reference to the span. If span is nil, a new context without an active span is returned.
func ExtractGrpcHeader ¶
func ExtractGrpcHeader(ctx context.Context) (opentracing.SpanContext, error)
ExtractGrpcHeader
func ExtractHttpHeader ¶
func ExtractHttpHeader(header http.Header) (opentracing.SpanContext, error)
ExtractHttpHeader
func GetCallerCache ¶
func GetCallerCache() string
func GetFuncSkip ¶
func GetSpanIDFromCtx ¶
GetSpanIDFromCtx get span id from context
func GetTraceIDFromCtx ¶
GetTraceIDFromCtx get trace id from context
func GetXTraceID ¶
func GetXTraceID(span opentracing.Span) string
GetXTraceID get x-trace-id by span
func GrpcSendHeader ¶
GrpcSendHeader grpc.SendHeader is called only once.
func InjectGrpcMD ¶
func InjectGrpcMD(span opentracing.Span, header metadata.MD, ctx context.Context) (context.Context, metadata.MD)
InjectGrpcMD
func InjectHttpHeader ¶
func InjectHttpHeader(span opentracing.Span, header http.Header) error
InjectHttpHeader
func MakeRandomNumber ¶
func MakeRandomNumber() uint64
func NewHttpSender ¶
func NewHttpSender(url string) jaeger.Transport
func NewRedisHook ¶
func NewRedisHook(tracer opentracing.Tracer) redis.Hook
NewHook creates a new go-redis hook instance and that will collect spans using the provided tracer.
func NewTracer ¶
func NewTracer(serviceName string, addr string, fns ...optionFunc) (opentracing.Tracer, io.Closer, error)
NewTracer
func NewTracerWithConfig ¶
NewTracerWithConfig
func ServerInterceptor ¶
func ServerInterceptor() grpc.UnaryServerInterceptor
ServerInterceptor grpc server wrapper
func SpanFromString ¶
ContextFromString build span by x-trace-id
func StartSpan ¶
func StartSpan(operation string, opts ...opentracing.StartSpanOption) opentracing.Span
StartSpan Create, start, and return a new Span with the given `operationName`.
func StartSpanContext ¶
func StartSpanContext(operation string, opts ...opentracing.StartSpanOption) (context.Context, opentracing.Span)
StartSpanContext
func StartSpanFromContext ¶
func StartSpanFromContext(ctx context.Context, operation string) (opentracing.Span, context.Context)
StartSpanFromContext starts and returns a Span with `operationName`, using any Span found within `ctx` as a ChildOfRef.
func StartSpanFromContextExt ¶
func StartSpanFromContextExt(ctx context.Context, fname string, request, response interface{}) (opentracing.Span, context.Context, func())
SpanFromContextExt
func StartSpanFromGinContext ¶
func TracingMiddleware ¶
func TracingMiddleware(name string) gin.HandlerFunc
TracingMiddleware gin middleware
func WithQueueSize ¶
func WithQueueSize(size int) optionFunc
WithQueueSize queue size, defualt: 10000
Types ¶
type MetadataHeader ¶
MetadataHeader metadata Reader and Writer
func (MetadataHeader) ForeachKey ¶
func (c MetadataHeader) ForeachKey(handler func(key, val string) error) error
ForeachKey implements ForeachKey of opentracing.TextMapReader
func (MetadataHeader) Set ¶
func (c MetadataHeader) Set(key, val string)
Set implements Set() of opentracing.TextMapWriter
type RedisTracingHook ¶
type RedisTracingHook struct {
// contains filtered or unexported fields
}
func (RedisTracingHook) AfterProcess ¶
func (hook RedisTracingHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error
func (RedisTracingHook) AfterProcessPipeline ¶
func (hook RedisTracingHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error