tracer

package
v0.0.0-...-f6b04e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderTraceIDKey      = "x-trace-id"
	HeaderSpanIDKey       = "x-span-id"
	HeaderTraceContextKey = "x-trace-ctx"
)

Variables

This section is empty.

Functions

func InitTracer

func InitTracer(c Config) error

func Trace

func Trace(ctx *gin.Context)

Trace Gin的链路中间件

Types

type Config

type Config struct {
	ServiceName string  `json:",optional"`
	Endpoint    string  `json:",optional"`
	Sampler     float64 `json:",default=1.0"`
	Batcher     string  `json:",default=otlphttp,options=zipkin|otlphttp|otlpgrpc"`
}

type Span

type Span struct {
	// contains filtered or unexported fields
}

func Extract

func Extract(req *http.Request, spanName string) Span

func ExtractByBaggage

func ExtractByBaggage(req *http.Request, spanName string) Span

func NewGinSpan

func NewGinSpan(ctx *gin.Context, spanName string) Span

func NewSpan

func NewSpan(ctx context.Context, spanName string) Span

NewSpan is 初始化新span

func (*Span) End

func (S *Span) End()

func (*Span) Inject

func (S *Span) Inject(req *http.Request)

func (*Span) InjectByBaggage

func (S *Span) InjectByBaggage(req *http.Request)

func (*Span) NewChildSpan

func (S *Span) NewChildSpan(spanName string) Span

func (*Span) SetBoolTag

func (S *Span) SetBoolTag(key string, value bool)

func (*Span) SetInt64Tag

func (S *Span) SetInt64Tag(key string, value int64)

func (*Span) SetIntTag

func (S *Span) SetIntTag(key string, value int)

func (*Span) SetNative

func (S *Span) SetNative(kv attribute.KeyValue)

func (*Span) SetObjectTag

func (S *Span) SetObjectTag(key string, value interface{}) error

func (*Span) SetStatus

func (S *Span) SetStatus(code codes.Code, desc string)

func (*Span) SetStringTag

func (S *Span) SetStringTag(key, value string)

func (*Span) Span

func (S *Span) Span() trace.Span

func (*Span) SpanContext

func (S *Span) SpanContext() context.Context

func (*Span) SpanID

func (S *Span) SpanID() string

func (*Span) TraceID

func (S *Span) TraceID() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL