trace

package
v0.0.0-...-bc1b0c2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 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

type NeedParam int

NeedParam 是否输出参数

func NeedTraceParam

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

NeedTraceParam 控制参数打印

type SpanContext

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

SpanContext 调用链追踪信息

func NewSpanContext

func NewSpanContext(opts ...SpanContextOption) *SpanContext

func (*SpanContext) FullKey

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

func (*SpanContext) Init

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

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

func (*SpanContext) Key

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

func (*SpanContext) NewSpan

func (c *SpanContext) NewSpan()

NewSpan 生成spanId

func (*SpanContext) Open

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

func (*SpanContext) ParentSpanID

func (c *SpanContext) ParentSpanID() string

func (*SpanContext) Reset

func (c *SpanContext) Reset()

func (*SpanContext) SpanID

func (c *SpanContext) SpanID() string

func (*SpanContext) TraceID

func (c *SpanContext) TraceID() string

func (*SpanContext) TraceType

func (c *SpanContext) TraceType() int

type SpanContextOption

type SpanContextOption func(*SpanContext)

func WithTraceKey

func WithTraceKey(traceKey string) SpanContextOption

type SpanType

type SpanType uint8

type Trace

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

func New

func New() *Trace

func (*Trace) Call

func (t *Trace) Call() bool

Call return call

func (*Trace) GetTraceFullKey

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

GetTraceFullKey 获取 traceKey

func (*Trace) GetTraceKey

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

GetTraceKey 获取 traceKey

func (*Trace) GetTraceType

func (t *Trace) GetTraceType() int

GetTraceType 获取 trace type

func (*Trace) InitTrace

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

InitTrace 获取 traceKey

func (*Trace) NeedTraceParam

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

NeedTraceParam 控制参数打印

func (*Trace) NewSpan

func (t *Trace) NewSpan()

NewSpan 生成 spanId

func (*Trace) OpenTrace

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

func (t *Trace) SetCall(call bool)

SetCall set call value

func (*Trace) SpanContext

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