Documentation ¶
Index ¶
- Constants
- Variables
- func Closer() (errs []error)
- func ConfigFromViper(v *viper.Viper) (c *config.Configuration, err error)
- func DoAfter(span opentracing.Span, resp *http.Response, err error)
- func DoBefore(ctx context.Context, req *http.Request, operationName string) (span opentracing.Span, newCtx context.Context, err error)
- func ExtractSpanFromGinContext(c *gin.Context) (span opentracing.Span, err error)
- func ExtractSpanFromHeader(req *http.Request, operationName string) (span opentracing.Span)
- func GinContextConvert(ctx context.Context, c *gin.Context) (newCtx context.Context, err error)
- func GinHandler() gin.HandlerFunc
- func Init(v *viper.Viper)
- func InjectSpanToGinContext(c *gin.Context, span opentracing.Span)
- func InjectSpanToHeader(req *http.Request, span opentracing.Span) (err error)
- func NewTracerDB(ctx context.Context, db *gorm.DB) *gorm.DB
- func RegisterDB(db *gorm.DB)
- type GormTraceHandler
Constants ¶
View Source
const ( //DBTraceContextKey opentracing在db中保存context的Key DBTraceContextKey = "trace.db.context" //DBTraceSpanKey opentracing在db中保存span的Key DBTraceSpanKey = "trace.db.span" )
View Source
const (
//TraceGinSpanKey opentracing在gin中保存span的Key
TraceGinSpanKey = "tracer.span"
)
Variables ¶
View Source
var DBStatement = string(ext.DBStatement)
DBStatement opentracing ext.DBStatement
View Source
var ( //Enable 是否启用Opentracing Enable bool )
Functions ¶
func ConfigFromViper ¶
func ConfigFromViper(v *viper.Viper) (c *config.Configuration, err error)
ConfigFromViper 从viper中获取配置信息
func DoBefore ¶
func DoBefore(ctx context.Context, req *http.Request, operationName string) (span opentracing.Span, newCtx context.Context, err error)
DoBefore http 请求之前
func ExtractSpanFromGinContext ¶
ExtractSpanFromGinContext .
func ExtractSpanFromHeader ¶
ExtractSpanFromHeader 从http请求头中获取链路跟踪信息 主要是给自己暴露的API请求过滤器中使用
func GinContextConvert ¶
GinContextConvert .
func InjectSpanToGinContext ¶
InjectSpanToGinContext .
func InjectSpanToHeader ¶
InjectSpanToHeader 将Span信息注入到Header中
func NewTracerDB ¶
NewTracerDB 获取新的带有span的DB
Types ¶
type GormTraceHandler ¶
type GormTraceHandler interface { CreateBefore(scope *gorm.Scope) CreateAfter(scope *gorm.Scope) QueryBefore(scope *gorm.Scope) QueryAfter(scope *gorm.Scope) RowQueryBefore(scope *gorm.Scope) RowQueryAfter(scope *gorm.Scope) UpdateBefore(scope *gorm.Scope) UpdateAfter(scope *gorm.Scope) DeleteBefore(scope *gorm.Scope) DeleteAfter(scope *gorm.Scope) RegisterDB(db *gorm.DB) }
GormTraceHandler opentracing处理gorm接口
Click to show internal directories.
Click to hide internal directories.