trace

package
v1.5.48 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

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

	EnpNo         NeedParam = 0
	EnpNormal     NeedParam = 1
	EnpOverMaxLen NeedParam = 2

	AnnotationTS = "ts"
	AnnotationTE = "te"
	AnnotationCS = "cs"
	AnnotationCR = "cr"
	AnnotationSR = "sr"
	AnnotationSS = "ss"
)

Variables

This section is empty.

Functions

func GetTraceParamMaxLen

func GetTraceParamMaxLen() uint

GetTraceParamMaxLen 获取控制参数长度

func SetTraceParamMaxLen

func SetTraceParamMaxLen(len uint)

SetTraceParamMaxLen 设置控制参数长度

Types

type NeedParam added in v1.4.38

type NeedParam int

NeedParam 是否输出参数

func NeedTraceParam

func NeedTraceParam(es SpanType, traceID string, len uint) NeedParam

NeedTraceParam 控制参数打印

type SpanContext added in v1.4.38

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

SpanContext 调用链追踪信息

func NewSpanContext added in v1.4.38

func NewSpanContext(opts ...SpanContextOption) *SpanContext

func (*SpanContext) FullKey added in v1.4.38

func (c *SpanContext) FullKey(full bool) string

func (*SpanContext) Init added in v1.4.38

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

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

func (*SpanContext) Key added in v1.4.38

func (c *SpanContext) Key(es SpanType) string

func (*SpanContext) NewSpan added in v1.4.38

func (c *SpanContext) NewSpan()

NewSpan 生成spanId

func (*SpanContext) Open added in v1.4.38

func (c *SpanContext) Open(traceID string) bool

func (*SpanContext) ParentSpanID added in v1.4.38

func (c *SpanContext) ParentSpanID() string

func (*SpanContext) Reset added in v1.4.38

func (c *SpanContext) Reset()

func (*SpanContext) SpanID added in v1.4.38

func (c *SpanContext) SpanID() string

func (*SpanContext) TraceID added in v1.4.38

func (c *SpanContext) TraceID() string

func (*SpanContext) TraceType added in v1.4.38

func (c *SpanContext) TraceType() int

type SpanContextOption added in v1.4.38

type SpanContextOption func(*SpanContext)

func WithTraceKey added in v1.4.38

func WithTraceKey(traceKey string) SpanContextOption

type SpanType added in v1.4.38

type SpanType uint8

type Trace added in v1.4.38

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

func New added in v1.4.38

func New() *Trace

func (*Trace) Call added in v1.4.38

func (t *Trace) Call() bool

Call return call

func (*Trace) GetTraceFullKey added in v1.4.38

func (t *Trace) GetTraceFullKey(full bool) string

GetTraceFullKey 获取 traceKey

func (*Trace) GetTraceKey added in v1.4.38

func (t *Trace) GetTraceKey(es SpanType) string

GetTraceKey 获取 traceKey

func (*Trace) GetTraceType added in v1.4.38

func (t *Trace) GetTraceType() int

GetTraceType 获取 trace type

func (*Trace) InitTrace added in v1.4.38

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

InitTrace 获取 traceKey

func (*Trace) NeedTraceParam added in v1.4.38

func (t *Trace) NeedTraceParam(es SpanType, len uint) NeedParam

NeedTraceParam 控制参数打印

func (*Trace) NewSpan added in v1.4.38

func (t *Trace) NewSpan()

NewSpan 生成 spanId

func (*Trace) OpenTrace added in v1.4.38

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

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

func (*Trace) SetCall added in v1.4.38

func (t *Trace) SetCall(call bool)

SetCall set call value

func (*Trace) SpanContext added in v1.4.38

func (t *Trace) SpanContext() *SpanContext

SpanContext 获取 SpanContext

Jump to

Keyboard shortcuts

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