Documentation
¶
Index ¶
- Constants
- func InjectHttp(req *http.Request, span Interface) error
- func OpentracingGin() gin.HandlerFunc
- func OpentracingGrpcClient() grpc.UnaryClientInterceptor
- func OpentracingGrpcServer() grpc.UnaryServerInterceptor
- type Config
- type Interface
- type Opentracer
- type Option
- type Span
- func (s Span) ChildContext(ctx context.Context) context.Context
- func (s Span) ChildContextWithSpan(ctx context.Context, operationName string) context.Context
- func (s Span) ChildSpan(operationName string) Interface
- func (s Span) Context() opentracing.SpanContext
- func (s Span) Error(err error)
- func (s Span) Finish()
- func (s Span) Info(alternatingKeyValues ...interface{})
- func (s Span) IsRegister() bool
- func (s Span) TraceID() string
- type TextMD
- type Tracer
Constants ¶
View Source
const KeySpan = "opentracing_span"
Variables ¶
This section is empty.
Functions ¶
func InjectHttp ¶
InjectHttp 将span以header的形式注入到http.Request里 这样子在http的接收方就可以解析头部的信息 ExtractHttp
func OpentracingGin ¶
func OpentracingGin() gin.HandlerFunc
OpentracingGin 将在此中间件内生成的span赋值给ctx向下传递, 下层通过tracex.ValueSpan(ctx) 获取span无需再次进行Finish
func OpentracingGrpcClient ¶
func OpentracingGrpcClient() grpc.UnaryClientInterceptor
OpentracingGrpcClient 客户端解码span数据并组装成可以再GRPC中解析的数据
func OpentracingGrpcServer ¶
func OpentracingGrpcServer() grpc.UnaryServerInterceptor
OpentracingGrpcServer 将在此中间件内生成的span赋值给ctx向下传递, 下层通过tracex.ValueSpan(ctx) 获取span无需再次进行Finish
Types ¶
type Interface ¶
type Interface interface { Info(alternatingKeyValues ...interface{}) Error(err error) Context() opentracing.SpanContext Finish() IsRegister() bool ChildSpan(operationName string) Interface ChildContext(ctx context.Context) context.Context ChildContextWithSpan(ctx context.Context, operationName string) context.Context Opentracer }
func ExtractHttp ¶
ExtractHttp 解析HTTP请求头,导出Span 这里会执行StartSpan命令,所以需要进行Finis操作
type Opentracer ¶
type Opentracer interface {
TraceID() string
}
Opentracer 定义公共接口,支持Zipkin Jaeger等等,目前仅实现 Jeager
type Span ¶
type Span struct { opentracing.Span // contains filtered or unexported fields }
func (Span) ChildContextWithSpan ¶
func (Span) Info ¶
func (s Span) Info(alternatingKeyValues ...interface{})
Info 跟s.LogKV是一样的,这里只是规范了下名字
func (Span) IsRegister ¶
type TextMD ¶
func (TextMD) ForeachKey ¶
ForeachKey 读取metadata中的span信息
Click to show internal directories.
Click to hide internal directories.