tracer

package
v0.0.0-...-dab46ad Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

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 Closer

func Closer() (errs []error)

Closer .

func ConfigFromViper

func ConfigFromViper(v *viper.Viper) (c *config.Configuration, err error)

ConfigFromViper 从viper中获取配置信息

func DoAfter

func DoAfter(span opentracing.Span, resp *http.Response, err error)

DoAfter http 请求之后

func DoBefore

func DoBefore(ctx context.Context, req *http.Request, operationName string) (span opentracing.Span, newCtx context.Context, err error)

DoBefore http 请求之前

func ExtractSpanFromGinContext

func ExtractSpanFromGinContext(c *gin.Context) (span opentracing.Span, err error)

ExtractSpanFromGinContext .

func ExtractSpanFromHeader

func ExtractSpanFromHeader(req *http.Request, operationName string) (span opentracing.Span)

ExtractSpanFromHeader 从http请求头中获取链路跟踪信息 主要是给自己暴露的API请求过滤器中使用

func GinContextConvert

func GinContextConvert(ctx context.Context, c *gin.Context) (newCtx context.Context, err error)

GinContextConvert .

func GinHandler

func GinHandler() gin.HandlerFunc

GinHandler .

func Init

func Init(v *viper.Viper)

Init 启用链路跟踪

func InjectSpanToGinContext

func InjectSpanToGinContext(c *gin.Context, span opentracing.Span)

InjectSpanToGinContext .

func InjectSpanToHeader

func InjectSpanToHeader(req *http.Request, span opentracing.Span) (err error)

InjectSpanToHeader 将Span信息注入到Header中

func NewTracerDB

func NewTracerDB(ctx context.Context, db *gorm.DB) *gorm.DB

NewTracerDB 获取新的带有span的DB

func RegisterDB

func RegisterDB(db *gorm.DB)

RegisterDB .

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接口

Jump to

Keyboard shortcuts

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