Documentation
¶
Overview ¶
包gtrace提供了使用OpenTelemetry进行跟踪功能的便利封装。 md5:4c5ceb4a418df579
Index ¶
- func CheckSetDefaultTextMapPropagator()
- func CommonLabels() []attribute.KeyValue
- func GetBaggageMap(ctx context.Context) *gmap.StrAnyMap
- func GetBaggageVar(ctx context.Context, key string) *gvar.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 SafeContent(data []byte) string
- func SafeContentForHttp(data []byte, header http.Header) (string, error)
- 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 如果之前未设置,默认情况下会设置文本映射传播器。 md5:586855119e290f63
func CommonLabels ¶
CommonLabels 返回常用属性标签: ip.intranet,hostname。 md5:8affbee0c43e3bad
func GetBaggageMap ¶
GetBaggageMap 获取并返回行李(baggage)的值作为map。 md5:c2fd062493b49cd1
func GetBaggageVar ¶
GetBaggageVar 从 baggage 中检索值,并为指定的键返回一个 *gvar.Var。 md5:b7635ba9a07703cf
func GetDefaultTextMapPropagator ¶
func GetDefaultTextMapPropagator() propagation.TextMapPropagator
GetDefaultTextMapPropagator 返回用于在对等体之间传播上下文的默认 propagator。 md5:c053466fb206297d
func GetTraceID ¶
GetTraceID 从 context 中检索并返回 TraceId。如果跟踪功能未启用,则返回空字符串。 md5:09e9e014a696e105
func IsTracingInternal ¶
func IsTracingInternal() bool
IsTracingInternal 返回是否正在追踪内部组件的跨度。 md5:4439b167674c69e6
func IsUsingDefaultProvider ¶
func IsUsingDefaultProvider() bool
IsUsingDefaultProvider 检查并返回当前是否正在使用默认的跟踪提供程序。 md5:dd9a8bbd104a14cf
func MaxContentLogSize ¶
func MaxContentLogSize() int
MaxContentLogSize 返回请求和响应体的最大日志大小,特别是对于HTTP/RPC请求。 md5:762f425039c664ca
func SafeContent ¶
SafeContent 通过 `MaxContentLogSize` 剪切并返回给定的内容。如果内容大小超过 `MaxContentLogSize`,则在结果的尾部添加字符串 `...`。 md5:7ea5429876707ef6
func SafeContentForHttp ¶
SafeContentForHttp 通过 `MaxContentLogSize` 剪切并返回给定内容。如果内容大小超过 `MaxContentLogSize`,它会在结果尾部添加字符串 `...`。 md5:ba3a657223c70042
func SetBaggageMap ¶
SetBaggageMap 是一个方便的函数,用于向行李中添加映射的键值对。 请注意,它使用 attribute.Any 来设置键值对。 md5:635cc7b15635106d
func SetBaggageValue ¶
SetBaggageValue 是一个便捷函数,用于向 baggage 中添加一个键值对。 注意,它使用 attribute.Any 来设置键值对。 md5:a0a5e77a036e4b8b
func WithTraceID ¶
WithTraceID 将自定义的跟踪ID注入上下文以进行传播。 md5:74657c53cd9aeefb
Types ¶
type Baggage ¶
type Baggage struct {
// contains filtered or unexported fields
}
Baggage在所有跟踪span中持有数据。 md5:0ad27152ec042f81
func NewBaggage ¶
NewBaggage 从给定的追踪上下文中创建并返回一个新的Baggage对象。 md5:6c3e8093bd06a60a
type Carrier ¶
type Carrier map[string]interface{}
Carrier是TextMapPropagator使用的存储介质。 md5:8d62ccc64614a0c7
func NewCarrier ¶
NewCarrier 创建并返回一个 Carrier。 md5:e8b512c41d0c9bd7
func (Carrier) MustMarshal ¶
MustMarshal 返回c的JSON编码. md5:58f2f2d8e0370a56
func (Carrier) UnmarshalJSON ¶
UnmarshalJSON 实现了 json 包中的 UnmarshalJSON 接口。 md5:6a50aca077e136ff