trace

package
v1.8.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const MaxContentLength = 1 << 16

Variables

View Source
var (
	// String ...
	String = log.String
)

Functions

func CustomTag

func CustomTag(key string, val interface{}) opentracing.Tag

CustomTag ...

func ESTraceServerInterceptor added in v1.6.17

func ESTraceServerInterceptor() *http.Client

func FromIncomingContext

func FromIncomingContext(ctx context.Context) opentracing.StartSpanOption

FromIncomingContext ...

func GRPCStreamServerInterceptor added in v1.1.23

func GRPCStreamServerInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

GRPCStreamServerInterceptor 监控程序跟踪

func GRPCUnaryServerInterceptor added in v1.1.23

func GRPCUnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

GRPCUnaryServerInterceptor 监控程序跟踪

func HBaseTrace added in v1.1.3

func HBaseTrace(component, instance string) hbase.HookFunc

HBaseTrace ...

func HTTPMetricServerInterceptor added in v1.1.23

func HTTPMetricServerInterceptor() gin.HandlerFunc

HTTPMetricServerInterceptor 监控程序跟踪

func HTTPTraceServerInterceptor added in v1.1.2

func HTTPTraceServerInterceptor() gin.HandlerFunc

HTTPTraceServerInterceptor 链路跟踪

func HeaderExtractor

func HeaderExtractor(hdr map[string][]string) opentracing.StartSpanOption

HeaderExtractor ...

func HeaderInjector

func HeaderInjector(ctx context.Context, hdr map[string][]string) context.Context

HeaderInjector ...

func MetadataExtractor

func MetadataExtractor(md map[string][]string) opentracing.StartSpanOption

MetadataExtractor ...

func MetadataInjector

func MetadataInjector(ctx context.Context, md metadata.MD) context.Context

MetadataInjector ...

func RPCTraceStreamServerInterceptor added in v1.1.2

func RPCTraceStreamServerInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

RPCTraceStreamServerInterceptor ...

func RPCTraceUnaryServerInterceptor added in v1.1.2

func RPCTraceUnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

RPCTraceUnaryServerInterceptor ...

func SpanFromContext

func SpanFromContext(ctx context.Context) opentracing.Span

SpanFromContext ...

func StartSpanFromContext

func StartSpanFromContext(ctx context.Context, op string, opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context)

StartSpanFromContext ...

func TagComponent

func TagComponent(component string) opentracing.Tag

TagComponent ...

func TagSpanKind

func TagSpanKind(kind string) opentracing.Tag

TagSpanKind ...

func TagSpanURL

func TagSpanURL(url string) opentracing.Tag

TagSpanURL ...

Types

type ESTracedTransport added in v1.6.17

type ESTracedTransport struct {
	*http.Transport
}

func (*ESTracedTransport) RoundTrip added in v1.6.17

func (t *ESTracedTransport) RoundTrip(r *http.Request) (resp *http.Response, err error)

type MetadataReaderWriter

type MetadataReaderWriter struct {
	MD map[string][]string
}

MetadataReaderWriter ...

func (MetadataReaderWriter) ForeachKey

func (w MetadataReaderWriter) ForeachKey(handler func(key, val string) error) error

ForeachKey ...

func (MetadataReaderWriter) Set

func (w MetadataReaderWriter) Set(key, val string)

Set ...

type NullStartSpanOption

type NullStartSpanOption struct{}

NullStartSpanOption ...

func (NullStartSpanOption) Apply

func (sso NullStartSpanOption) Apply(options *opentracing.StartSpanOptions)

Apply ...

type TraceConfig

type TraceConfig struct {
	ServiceName         string
	SamplingServerURL   string
	SamplingParam       float64
	SamplingType        string
	BufferFlushInterval time.Duration
	LogSpans            bool
	QueueSize           int
	PropagationFormat   string
}

TraceConfig 实列

func InitConfig

func InitConfig(url string) TraceConfig

InitConfig 初始化 config

type Tracing

type Tracing struct {
	// contains filtered or unexported fields
}

Tracing tracing的基类

func New

func New(cfg TraceConfig) *Tracing

New 按照配置信息初始化tracing

func (*Tracing) Close

func (t *Tracing) Close()

Close 关闭tracer

func (*Tracing) Setup

func (t *Tracing) Setup() (err error)

Setup 根据tracing的属性选择合适的opentracing客户端

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL