Documentation
¶
Overview ¶
Package trace 基于 context 封装一个 trace ID 功能
Index ¶
- func EnsureTraceID(ctx context.Context) context.Context
- func TraceID(ctx context.Context) string
- func TraceIDContextKey() any
- func TraceIDStack(ctx context.Context) []string
- func WithTraceID(ctx context.Context, traceID string) context.Context
- func WithTraceIDStack(ctx context.Context, traceIDStack []string) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureTraceID ¶
EnsureTraceID 确保 context 中有一个 trace ID
func TraceIDContextKey ¶
func TraceIDContextKey() any
TraceIDContextKey 返回 trace ID 的 context key, 用于一些外部需要复制 context 的 key / value 的场景
func TraceIDStack ¶
TraceIDStack 从 context 中读取历史 trace ID 栈
func WithTraceID ¶
WithTraceID 更新 trace ID
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.