Documentation ¶
Index ¶
- func GetDuration(span opentracing.Span) time.Duration
- func GetTraceID(ctx context.Context) (traceID string)
- func InjectTraceHeader(ctx opentracing.SpanContext, req *http.Request)
- func StartFollowSpanFromContext(ctx context.Context, operation string) (opentracing.Span, context.Context)
- func StartSpanFromContext(ctx context.Context, operationName string, opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context)
- func StartSpanServerHTTP(r *http.Request, operation string) (req *http.Request, span opentracing.Span)
- func Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDuration ¶ added in v1.3.2
func GetDuration(span opentracing.Span) time.Duration
GetDuration 查询当前 span 耗时
func InjectTraceHeader ¶
func InjectTraceHeader(ctx opentracing.SpanContext, req *http.Request)
InjectTrace 注入 OpenTracing 头信息
func StartFollowSpanFromContext ¶ added in v1.3.0
func StartFollowSpanFromContext(ctx context.Context, operation string) (opentracing.Span, context.Context)
StartFollowSpanFromContext 开起一个 follow 类型 span follow 类型用于异步任务,可能在 root span 结束之后才完成。
func StartSpanFromContext ¶
func StartSpanFromContext(ctx context.Context, operationName string, opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context)
StartSpanFromContext starts and returns a Span with `operationName`, using any Span found within `ctx` as a ChildOfRef. If no such parent could be found, StartSpanFromContext creates a root (parentless) Span.
The second return value is a context.Context object built around the returned Span.
Example usage:
SomeFunction(ctx context.Context, ...) { sp, ctx := opentracing.StartSpanFromContext(ctx, "SomeFunction") defer sp.Finish() ... }
func StartSpanServerHTTP ¶
func StartSpanServerHTTP(r *http.Request, operation string) (req *http.Request, span opentracing.Span)
StartSpanServerHTTP 启动http服务的span
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.