Documentation ¶
Overview ¶
gtrace包提供了一种便利的封装功能,用于使用OpenTelemetry进行跟踪特性。
Index ¶
- func CheckSetDefaultTextMapPropagator()
- func CommonLabels() []attribute.KeyValue
- func GetBaggageMap(ctx context.Context) *map类.StrAnyMap
- func GetBaggageVar(ctx context.Context, key string) *泛型类.Var
- func GetDefaultTextMapPropagator() propagation.TextMapPropagator
- func GetSpanID(ctx context.Context) string
- func GetTraceID(ctx context.Context) string
- func IsTracingInternal() bool
- func IsUsingDefaultProvider() bool
- func MaxContentLogSize() int
- func SetBaggageMap(ctx context.Context, data map[string]interface{}) context.Context
- func SetBaggageValue(ctx context.Context, key string, value interface{}) 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 Carrier
- type Span
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckSetDefaultTextMapPropagator ¶
func CheckSetDefaultTextMapPropagator()
CheckSetDefaultTextMapPropagator 检查并设置默认的 TextMapPropagator。如果此前未设置,则进行设置。
func CommonLabels ¶
CommonLabels 返回常用属性标签: ip.intranet(内网IP),hostname(主机名)
func GetBaggageMap ¶
GetBaggageMap 获取并以map形式返回 baggage 的值。
func GetBaggageVar ¶
GetBaggageVar 从 baggage 中按照指定键检索值,并返回一个 *gvar.Var 类型的结果。
func GetDefaultTextMapPropagator ¶
func GetDefaultTextMapPropagator() propagation.TextMapPropagator
GetDefaultTextMapPropagator 返回用于在对等节点间传播上下文的默认载体。
func GetTraceID ¶
GetTraceID 从上下文中检索并返回 TraceId。 如果追踪功能未激活,则返回一个空字符串。
func IsUsingDefaultProvider ¶
func IsUsingDefaultProvider() bool
IsUsingDefaultProvider 检查并返回当前是否正在使用默认跟踪提供程序。
func MaxContentLogSize ¶
func MaxContentLogSize() int
MaxContentLogSize 返回请求和响应正文的最大日志大小,特别是针对HTTP/RPC请求。
func SetBaggageMap ¶
SetBaggageMap 是一个方便的函数,用于向 baggage 中添加映射键值对。 注意,它使用 attribute.Any 来设置键值对。
func SetBaggageValue ¶
SetBaggageValue 是一个方便的函数,用于向 baggage 添加一对键值对。 注意,它使用 attribute.Any 来设置键值对。
func WithTraceID ¶
WithTraceID 向上下文中注入自定义跟踪 ID,以便进行传播。
Types ¶
type Baggage ¶
type Baggage struct {
// contains filtered or unexported fields
}
Baggage 在所有追踪跨度中保存数据。
func NewBaggage ¶
NewBaggage 从给定的追踪上下文中创建并返回一个新的 Baggage 对象。
type Carrier ¶
type Carrier map[string]interface{}
2024-01-14 备注,此文件方法不要翻译, gtrace_z_unit_carrier_test.go, "otel.GetTextMapPropagator().Inject(ctx, carrier1)" carrier1参数要求TextMapCarrier类型结构体.
Carrier 是 TextMapPropagator 使用的存储介质。
func NewCarrier ¶
NewCarrier 创建并返回一个 Carrier。
func (Carrier) Get ¶
2024-01-14 备注,此文件方法不要翻译, gtrace_z_unit_carrier_test.go, "otel.GetTextMapPropagator().Inject(ctx, carrier1)" carrier1参数要求TextMapCarrier类型结构体.
Get 方法用于获取与传递的键关联的值。
func (Carrier) Set ¶
2024-01-14 备注,此文件方法不要翻译, gtrace_z_unit_carrier_test.go, "otel.GetTextMapPropagator().Inject(ctx, carrier1)" carrier1参数要求TextMapCarrier类型结构体.
Set 存储键值对。
func (Carrier) UnmarshalJSON ¶
UnmarshalJSON 实现了 json 包中的 UnmarshalJSON 接口。