trace

package
v0.0.0-...-089dc8e Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootSpanId             = ""
	RootParentSpanId       = ""
	SeparatorSpanIdIndex   = "."
	SeparatorTraceIdSpanId = "."
)
View Source
const (
	TraceIdName      = "Trace-Id"
	SpanIdName       = "Span-Id"
	ParentSpanIdName = "Parent-Span-Id"
	TraceSpanIdName  = "Trace-Span-Id"
)

Variables

View Source
var Utils *traceUtils

Functions

func BeginSpan

func BeginSpan()

func EndSpan

func EndSpan()

func Exists

func Exists() bool

func GetParentSpanId

func GetParentSpanId() string

func GetSpanId

func GetSpanId() string

func GetTraceId

func GetTraceId() string

func GetTraceSpanId

func GetTraceSpanId() string

func Init

func Init()

func InitByHttp

func InitByHttp(reqHeader, respHeader http.Header)

func InitByValue

func InitByValue(traceId, spanId, parentSpanId string)

func Reset

func Reset()

func Setup

func Setup(appName string)

Types

type Counter

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

Counter 一天的计数器

func DefaultCounter

func DefaultCounter() *Counter

func NewCounter

func NewCounter(year int, month time.Month, day int) *Counter

func (*Counter) Increase

func (c *Counter) Increase() int64

type ISequence

type ISequence interface {
	//Next 获取下一个计数
	Next() int64
}

type ISpan

type ISpan interface {
	//ContinueSpan 开启子 Span
	ContinueSpan() ISpan
	//GetTraceId 获取当前 Span 的 TraceId
	GetTraceId() string
	//GetSpanId 获取当前 Span 的 SpanId
	GetSpanId() string
	//GetParentSpanId 获取当前 Span 的 ParentSpanId
	GetParentSpanId() string
	//GetTraceSpanId 获取当前 Span 的 TraceSpanId
	GetTraceSpanId() string
}
var EmptySpan ISpan = &emptySpan{}

type ITracer

type ITracer interface {
	//CreateRoot 创建初始 ISpan
	CreateRoot() ISpan
	//CreateSpan 根据指定的值创建 ISpan
	CreateSpan(traceId string, spanId string, parentSpanId string) ISpan
	//CreateContinueSpan 根据 ISpan 创建子 ISpan
	CreateContinueSpan(span ISpan) ISpan
}

type LinkedHashMap

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

func (*LinkedHashMap) Put

func (t *LinkedHashMap) Put(key string, value any)

func (*LinkedHashMap) String

func (t *LinkedHashMap) String() string

type LogMap

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

func (*LogMap) Put

func (t *LogMap) Put(key string, value any)

func (*LogMap) String

func (t *LogMap) String() string

type Sequence

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

Sequence 计数器, 日期变化后从 1 开始计数

func NewSequence

func NewSequence() *Sequence

func (*Sequence) Next

func (s *Sequence) Next() int64

type Span

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

func NewSpan

func NewSpan(traceId string, spanId string, parentSpanId string) *Span

func (*Span) ContinueSpan

func (s *Span) ContinueSpan() ISpan

func (*Span) GetParentSpanId

func (s *Span) GetParentSpanId() string

func (*Span) GetSpanId

func (s *Span) GetSpanId() string

func (*Span) GetTraceId

func (s *Span) GetTraceId() string

func (*Span) GetTraceSpanId

func (s *Span) GetTraceSpanId() string

type Tracer

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

func NewTracer

func NewTracer(appName string, sequence ISequence) *Tracer

func (Tracer) CreateContinueSpan

func (t Tracer) CreateContinueSpan(span ISpan) ISpan

func (Tracer) CreateRoot

func (t Tracer) CreateRoot() ISpan

func (Tracer) CreateSpan

func (t Tracer) CreateSpan(traceId string, spanId string, parentSpanId string) ISpan

Directories

Path Synopsis
internal
net
logging
MDC

Jump to

Keyboard shortcuts

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