ginopentrace

package
v0.0.0-...-47b6ad5 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Host = "localhost"

Host h

View Source
var Port = "6831"

Port p

Functions

func GetCtxFromGinContext

func GetCtxFromGinContext(ctx *gin.Context) context.Context

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

func NewOpenTraceClient() (p opentracing.Tracer, i io.Closer)

NewOpenTraceClient 连接

func SetSamplingFrequency

func SetSamplingFrequency(n int)

SetSamplingFrequency 设置采样频率 0 <= n <= 100

func SpanTransferFromContextToHeader

func SpanTransferFromContextToHeader(ctx context.Context) context.Context

SpanTransferFromContextToHeader extract span from ctx

func TracerWrapper

func TracerWrapper(c *gin.Context)

TracerWrapper tracer 中间件

Types

type MWOption

type MWOption func(*mwOptions)

MWOption controls the behavior of the Middleware.

func MWComponentName

func MWComponentName(componentName string) MWOption

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

func MWURLTagFunc(f func(u *url.URL) string) MWOption

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.

func OperationNameFunc

func OperationNameFunc(f func(r *http.Request) string) MWOption

OperationNameFunc returns a MWOption that uses given function f to generate operation name for each app-side span.

Jump to

Keyboard shortcuts

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