Documentation
¶
Index ¶
- func CheckSetDefaultTextMapPropagator()
- func GetBaggageMap(ctx context.Context) map[string]any
- func GetBaggageVar(ctx context.Context, key string) *mvar.Var
- func GetDefaultTextMapPropagator() propagation.TextMapPropagator
- func GetSpanID(ctx context.Context) string
- func GetTraceID(ctx context.Context) string
- func IsUsingDefaultProvider() bool
- func SetBaggageMap(ctx context.Context, data map[string]any) context.Context
- func SetBaggageValue(ctx context.Context, key string, value any) context.Context
- func WithTraceID(ctx context.Context, traceID string) (context.Context, error)
- func WithUUID(ctx context.Context, uuid string) (context.Context, error)
- type Baggage
- type Span
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckSetDefaultTextMapPropagator ¶
func CheckSetDefaultTextMapPropagator()
CheckSetDefaultTextMapPropagator 如果之前未设置,则设置默认的 TextMapPropagator
func GetBaggageMap ¶
GetBaggageMap 获取并返回 baggage 值的 map
func GetBaggageVar ¶
GetBaggageVar 从 baggage 中获取指定 key 的值并返回 *mvar.Var
func GetDefaultTextMapPropagator ¶
func GetDefaultTextMapPropagator() propagation.TextMapPropagator
GetDefaultTextMapPropagator 返回用于对等体间上下文传播的默认传播器
func IsUsingDefaultProvider ¶
func IsUsingDefaultProvider() bool
IsUsingDefaultProvider 检查是否使用默认的 trace provider
func SetBaggageMap ¶
SetBaggageMap 是一个便捷函数,用于向 baggage 添加多个键值对
func SetBaggageValue ¶
SetBaggageValue 是一个便捷函数,用于向 baggage 添加一个键值对
func WithTraceID ¶
WithTraceID 将自定义的 trace id 注入到上下文中
Types ¶
type Baggage ¶
type Baggage struct {
// contains filtered or unexported fields
}
Baggage 是一种在分布式系统的上下文中传播键值对数据的机制 它允许将自定义数据(如用户ID、请求ID等)附加到跟踪中,并在服务调用之间传播
Click to show internal directories.
Click to hide internal directories.