trace

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: BSD-3-Clause Imports: 3 Imported by: 5

Documentation

Index

Constants

View Source
const (
	TraceAnnotationTS = "ts"
	TraceAnnotationTE = "te"
	TraceAnnotationCS = "cs"
	TraceAnnotationCR = "cr"
	TraceAnnotationSR = "sr"
	TraceAnnotationSS = "ss"
)

Variables

View Source
var (
	EstCS ESpanType = 1
	EstCR ESpanType = 2
	EstSR ESpanType = 4
	EstSS ESpanType = 8
	EstTS ESpanType = 9
	EstTE ESpanType = 10

	EnpNo         ENeedParam = 0
	EnpNormal     ENeedParam = 1
	EnpOverMaxLen ENeedParam = 2
)

Functions

func GetTraceParamMaxLen

func GetTraceParamMaxLen() uint

GetTraceParamMaxLen 获取控制参数长度

func SetTraceParamMaxLen

func SetTraceParamMaxLen(len uint)

SetTraceParamMaxLen 设置控制参数长度

func TraceContextInitType

func TraceContextInitType(tid string) (tType int, maxLen uint)

TraceContextInitType parse type and maxLen

Types

type ENeedParam

type ENeedParam int

func NeedTraceParam

func NeedTraceParam(es ESpanType, traceID string, len uint) ENeedParam

NeedTraceParam 控制参数打印

func TraceContextNeedParam

func TraceContextNeedParam(es ESpanType, tType int, len uint, maxLen uint) ENeedParam

TraceContextNeedParam return: 0 不需要参数, 1:正常打印参数, 2:参数太长返回默认串

type ESpanType

type ESpanType uint8

type TraceContext

type TraceContext struct {
	// contains filtered or unexported fields
}

func (*TraceContext) Init

func (c *TraceContext) Init(traceKey string) bool

Init key 分两种情况,1.rpc调用; 2.异步回调 eg: f.2-ee824ad0eb4dacf56b29d230a229c584|030019ac000010796162bc5900000021|030019ac000010796162bc5900000021

func (*TraceContext) Reset

func (c *TraceContext) Reset()

type TraceData

type TraceData struct {
	TraceCall    bool
	TraceContext *TraceContext
}

func NewTraceData

func NewTraceData() *TraceData

func (*TraceData) GetTraceKey

func (t *TraceData) GetTraceKey(es ESpanType) string

GetTraceKey 获取 traceKey

func (*TraceData) GetTraceKeyFull

func (t *TraceData) GetTraceKeyFull(full bool) string

GetTraceKeyFull 获取 traceKey

func (*TraceData) GetTraceType

func (t *TraceData) GetTraceType() int

GetTraceType 获取 trace type

func (*TraceData) InitTrace

func (t *TraceData) InitTrace(traceKey string) bool

InitTrace 获取 traceKey

func (*TraceData) NeedTraceParam

func (t *TraceData) NeedTraceParam(es ESpanType, len uint) ENeedParam

NeedTraceParam 控制参数打印

func (*TraceData) NewSpan

func (t *TraceData) NewSpan()

NewSpan 获取 traceKey

func (*TraceData) OpenTrace

func (t *TraceData) OpenTrace(traceFlag int, maxLen uint) bool

OpenTrace 业务主动打开调用链 @param traceFlag: 调用链日志输出参数控制,取值范围0-15, 0 不用打参数, 其他情况按位做控制开关,从低位到高位分别控制CS、CR、SR、SS,为1则输出对应参数 @param maxLen: 参数输出最大长度, 不传或者默认0, 则按服务模板默认取值

Jump to

Keyboard shortcuts

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