Documentation ¶
Index ¶
- Constants
- func ContextToString(ctx context.Context) string
- func ExtractHttpHeader(ctx context.Context, header http.Header) (context.Context, trace.Span)
- func GetPropagator() propagation.TextMapPropagator
- func GetTraceIDFromCtx(ctx context.Context) string
- func GetTraceSpanIDsFromCtx(ctx context.Context) (string, string)
- func GetTracer() trace.Tracer
- func GetTracerProvider() *tracesdk.TracerProvider
- func GinMiddleware(service string, opts ...TracerOption) gin.HandlerFunc
- func GrpcSendHeader(ctx context.Context, header metadata.MD)
- func GrpcUnaryDialOption() grpc.DialOption
- func GrpcUnaryServerOption() grpc.ServerOption
- func HTML(c *gin.Context, code int, name string, obj interface{})
- func InjectHttpHeader(ctx context.Context, header http.Header)
- func New(serviceName string, fns ...optionFunc) (*tracesdk.TracerProvider, error)
- func NewIDGenerator() *traceIDGenerator
- func NewObjectID() objectID
- func NewWithConfig(serviceName string, cfg *Config) (*tracesdk.TracerProvider, error)
- func SetPropagator(pro propagation.TextMapPropagator)
- func SetTracerProvider(provider *tracesdk.TracerProvider)
- func Shutdown(ctx context.Context)
- func SpanContextFromContext(ctx context.Context) trace.SpanContext
- func SpanFromContext(ctx context.Context) trace.Span
- func SpanFromString(xid string, spanName string) (context.Context, trace.Span)
- func Start(ctx context.Context, operation string) (context.Context, trace.Span)
- func StreamClientInterceptor() grpc.StreamClientInterceptor
- func StreamServerInterceptor() grpc.StreamServerInterceptor
- func UnaryClientInterceptor() grpc.UnaryClientInterceptor
- func UnaryServerInterceptor() grpc.UnaryServerInterceptor
- func WithAddress(addr string) optionFunc
- func WithHttpClient(client *http.Client) optionFunc
- func WithMode(mode string) optionFunc
- func WithQueueSize(size int) optionFunc
- type Config
- type Span
- func (sp *Span) AddEvent(val interface{})
- func (sp *Span) AddEventa(args ...interface{})
- func (sp *Span) AddEventf(format string, args ...interface{})
- func (sp *Span) AddJsonEvent(val interface{})
- func (sp *Span) DeferEnd() func()
- func (sp *Span) End()
- func (sp *Span) SetAttributes(key string, val interface{})
- func (sp *Span) SetJsonTag(key string, val interface{})
- func (sp *Span) SetName(name string)
- func (sp *Span) SetStatus(code codes.Code, description string)
- func (sp *Span) SetTag(key string, val interface{})
- func (sp *Span) Span() trace.Span
- func (sp *Span) SpanContext() trace.SpanContext
- func (sp *Span) SpanID() string
- func (sp *Span) TraceID() string
- type TracerOption
Constants ¶
View Source
const ( ModeAgentUdp = "udp" ModeCollectorHttp = "http" HeaderTraceID = "trace-id" HeaderSpanID = "span-id" )
View Source
const (
HeaderTracesTate = "tracestate"
)
Variables ¶
This section is empty.
Functions ¶
func ExtractHttpHeader ¶
ExtractHttpHeader
func GetTraceIDFromCtx ¶ added in v1.5.2
GetTraceIDFromCtx
func GetTraceSpanIDsFromCtx ¶ added in v1.5.2
GetTraceSpanIDsFromCtx
func GinMiddleware ¶
func GinMiddleware(service string, opts ...TracerOption) gin.HandlerFunc
func GrpcSendHeader ¶ added in v1.5.2
GrpcSendHeader insert traceID and spanID to header, grpc send header
func GrpcUnaryDialOption ¶
func GrpcUnaryDialOption() grpc.DialOption
GrpcDialOption grpc client option
func GrpcUnaryServerOption ¶
func GrpcUnaryServerOption() grpc.ServerOption
GrpcUnaryServerOption grpc server option
func InjectHttpHeader ¶
InjectHttpHeader
func NewIDGenerator ¶ added in v1.5.3
func NewIDGenerator() *traceIDGenerator
func NewObjectID ¶ added in v1.5.3
func NewObjectID() objectID
func NewWithConfig ¶
func NewWithConfig(serviceName string, cfg *Config) (*tracesdk.TracerProvider, error)
NewWithConfig
func SetTracerProvider ¶
func SetTracerProvider(provider *tracesdk.TracerProvider)
SetTracerProvider
func SpanContextFromContext ¶ added in v1.5.2
func SpanContextFromContext(ctx context.Context) trace.SpanContext
SpanContextFromContext
func SpanFromContext ¶ added in v1.5.2
SpanFromContext
func SpanFromString ¶
SpanFromString
func StreamClientInterceptor ¶
func StreamClientInterceptor() grpc.StreamClientInterceptor
StreamClientInterceptor for grpc
func StreamServerInterceptor ¶
func StreamServerInterceptor() grpc.StreamServerInterceptor
StreamServerInterceptor for grpc
func UnaryClientInterceptor ¶
func UnaryClientInterceptor() grpc.UnaryClientInterceptor
UnaryClientInterceptor for grpc
func UnaryServerInterceptor ¶
func UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor for grpc
func WithQueueSize ¶
func WithQueueSize(size int) optionFunc
WithQueueSize queue size, default: 5000
Types ¶
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
func (*Span) AddJsonEvent ¶
func (sp *Span) AddJsonEvent(val interface{})
func (*Span) SetAttributes ¶
func (*Span) SetJsonTag ¶
func (*Span) SpanContext ¶
func (sp *Span) SpanContext() trace.SpanContext
type TracerOption ¶
type TracerOption interface {
// contains filtered or unexported methods
}
Option specifies instrumentation configuration options.
func WithPropagators ¶
func WithPropagators(propagators propagation.TextMapPropagator) TracerOption
func WithTracerProvider ¶
func WithTracerProvider(provider oteltrace.TracerProvider) TracerOption
Click to show internal directories.
Click to hide internal directories.