Documentation
¶
Index ¶
- Constants
- func GenerateSpanByMd(md map[string]string, operationName string) (opentracing.Span, map[string]string, error)
- func GenerateSpanWithContext(ctx context.Context, operationName string) (opentracing.Span, context.Context, error)
- func GenerateSpanWithMap(md2 map[string]string, operationName string) (opentracing.Span, map[string]string, error)
- func GetTraceIDFromMd(md map[string]string) string
- func GetTraceIDFromSpan(span opentracing.Span) string
- func NewTracer(servicename string, addr string) (opentracing.Tracer, io.Closer, error)
- type JaegerPlugin
- type RecordPlugin
Constants ¶
View Source
const JAEGER_KEY = "uber-trace-id"
Variables ¶
This section is empty.
Functions ¶
func GenerateSpanByMd ¶
func GenerateSpanByMd(md map[string]string, operationName string) (opentracing.Span, map[string]string, error)
不破坏原数据,返回追加了Jaeger_key的数据
func GenerateSpanWithContext ¶
func GenerateSpanWithContext(ctx context.Context, operationName string) (opentracing.Span, context.Context, error)
只适用于 jaeger 原理用 context 传递 "__req_metadata":""uber-trace-id -> 6f8b8a1101b0124f:6f8b8a1101b0124f:0000000000000000:1
uber-trace-id traceID : spanID : parentID: sampled bool
func GenerateSpanWithMap ¶
func GetTraceIDFromMd ¶ added in v1.0.4
GetTraceIDFromMd 从 metadata map 中提取 trace_id metadata 中 uber-trace-id 格式: traceID:spanID:parentID:sampled
func GetTraceIDFromSpan ¶ added in v1.0.4
func GetTraceIDFromSpan(span opentracing.Span) string
GetTraceIDFromSpan 从 opentracing.Span 中提取 trace_id
Types ¶
type JaegerPlugin ¶
type JaegerPlugin struct {
// contains filtered or unexported fields
}
func NewJaegerPlugin ¶
func NewJaegerPlugin(t opentracing.Tracer) *JaegerPlugin
func (*JaegerPlugin) PostReadRequest ¶
type RecordPlugin ¶
type RecordPlugin struct {
// contains filtered or unexported fields
}
func NewRecordPlugin ¶
func NewRecordPlugin(slog slog.Slog) *RecordPlugin
Click to show internal directories.
Click to hide internal directories.