trace

package
v2.8.13 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: Apache-2.0 Imports: 23 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

func ESTraceServerInterceptor() *http.Client

func FromIncomingContext

func FromIncomingContext(ctx context.Context) opentracing.StartSpanOption

FromIncomingContext ...

func GRPCStreamServerInterceptor

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

GRPCStreamServerInterceptor 监控程序跟踪

func GRPCUnaryServerInterceptor

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

GRPCUnaryServerInterceptor 监控程序跟踪

func HTTPMetricServerInterceptor

func HTTPMetricServerInterceptor() gin.HandlerFunc

HTTPMetricServerInterceptor 监控程序跟踪

func HTTPTraceServerInterceptor

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

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

RPCTraceStreamServerInterceptor ...

func RPCTraceUnaryServerInterceptor

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 SpanHttpStartName added in v2.8.0

func SpanHttpStartName(ctx *gin.Context) string

func SpanRpcClientStartName added in v2.8.0

func SpanRpcClientStartName(method string) string

func SpanRpcServerStartName added in v2.8.0

func SpanRpcServerStartName(method string) string

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

type ESTracedTransport struct {
	*http.Transport
}

func (*ESTracedTransport) RoundTrip

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