Documentation ¶
Index ¶
- Variables
- func GetCtxFromGinContext(ctx *gin.Context) context.Context
- func Middleware(tr opentracing.Tracer, options ...MWOption) gin.HandlerFunc
- func NewOpenTraceClient() (p opentracing.Tracer, i io.Closer)
- func SetSamplingFrequency(n int)
- func SpanTransferFromContextToHeader(ctx context.Context) context.Context
- func TracerWrapper(c *gin.Context)
- type MWOption
Constants ¶
This section is empty.
Variables ¶
View Source
var Host = "localhost"
Host h
View Source
var Port = "6831"
Port p
Functions ¶
func GetCtxFromGinContext ¶
GetCtxFromGinContext extract span from ctx http 请求中调用grpc服务时使用
func Middleware ¶
func Middleware(tr opentracing.Tracer, options ...MWOption) gin.HandlerFunc
Middleware is a gin native version of the equivalent middleware in:
https://github.com/opentracing-contrib/go-stdlib/
func NewOpenTraceClient ¶
NewOpenTraceClient 连接
func SetSamplingFrequency ¶
func SetSamplingFrequency(n int)
SetSamplingFrequency 设置采样频率 0 <= n <= 100
func SpanTransferFromContextToHeader ¶
SpanTransferFromContextToHeader extract span from ctx
Types ¶
type MWOption ¶
type MWOption func(*mwOptions)
MWOption controls the behavior of the Middleware.
func MWComponentName ¶
MWComponentName returns a MWOption that sets the component name for the app-side span.
func MWSpanObserver ¶
func MWSpanObserver(f func(span opentracing.Span, r *http.Request)) MWOption
MWSpanObserver returns a MWOption that observe the span for the app-side span.
func MWURLTagFunc ¶
MWURLTagFunc returns a MWOption that uses given function f to set the span's http.url tag. Can be used to change the default http.url tag, eg to redact sensitive information.
Click to show internal directories.
Click to hide internal directories.