otel

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: MIT Imports: 29 Imported by: 0

Documentation

Index

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 ContextToString

func ContextToString(ctx context.Context) string

ContextToString

func ExtractHttpHeader

func ExtractHttpHeader(ctx context.Context, header http.Header) (context.Context, trace.Span)

ExtractHttpHeader

func GetPropagator

func GetPropagator() propagation.TextMapPropagator

GetPropagator

func GetTraceIDFromCtx added in v1.5.2

func GetTraceIDFromCtx(ctx context.Context) string

GetTraceIDFromCtx

func GetTraceSpanIDsFromCtx added in v1.5.2

func GetTraceSpanIDsFromCtx(ctx context.Context) (string, string)

GetTraceSpanIDsFromCtx

func GetTracer

func GetTracer() trace.Tracer

GetTracer

func GetTracerProvider

func GetTracerProvider() *tracesdk.TracerProvider

GetTracerProvider

func GinMiddleware

func GinMiddleware(service string, opts ...TracerOption) gin.HandlerFunc

func GrpcSendHeader added in v1.5.2

func GrpcSendHeader(ctx context.Context, header metadata.MD)

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 HTML

func HTML(c *gin.Context, code int, name string, obj interface{})

func InjectHttpHeader

func InjectHttpHeader(ctx context.Context, header http.Header)

InjectHttpHeader

func New

func New(serviceName string, fns ...optionFunc) (*tracesdk.TracerProvider, error)

New

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 SetPropagator

func SetPropagator(pro propagation.TextMapPropagator)

SetPropagator

func SetTracerProvider

func SetTracerProvider(provider *tracesdk.TracerProvider)

SetTracerProvider

func Shutdown

func Shutdown(ctx context.Context)

Shutdown

func SpanContextFromContext added in v1.5.2

func SpanContextFromContext(ctx context.Context) trace.SpanContext

SpanContextFromContext

func SpanFromContext added in v1.5.2

func SpanFromContext(ctx context.Context) trace.Span

SpanFromContext

func SpanFromString

func SpanFromString(xid string, spanName string) (context.Context, trace.Span)

SpanFromString

func Start

func Start(ctx context.Context, operation string) (context.Context, trace.Span)

Start

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 WithAddress

func WithAddress(addr string) optionFunc

WithAddress

func WithHttpClient

func WithHttpClient(client *http.Client) optionFunc

WithHttpClient

func WithMode

func WithMode(mode string) optionFunc

WithMode, udp or http

func WithQueueSize

func WithQueueSize(size int) optionFunc

WithQueueSize queue size, default: 5000

Types

type Config

type Config struct {
	Mode      string `yaml:"mode"`
	Address   string `yaml:"addr"`
	QueueSize int    `yaml:"queue_size"`
	// contains filtered or unexported fields
}

type Span

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

func StartSpan

func StartSpan(ctx context.Context, operation string) (context.Context, *Span)

StartSpan

func (*Span) AddEvent

func (sp *Span) AddEvent(val interface{})

func (*Span) AddEventa

func (sp *Span) AddEventa(args ...interface{})

func (*Span) AddEventf

func (sp *Span) AddEventf(format string, args ...interface{})

func (*Span) AddJsonEvent

func (sp *Span) AddJsonEvent(val interface{})

func (*Span) DeferEnd

func (sp *Span) DeferEnd() func()

func (*Span) End

func (sp *Span) End()

func (*Span) SetAttributes

func (sp *Span) SetAttributes(key string, val interface{})

func (*Span) SetJsonTag

func (sp *Span) SetJsonTag(key string, val interface{})

func (*Span) SetName

func (sp *Span) SetName(name string)

func (*Span) SetStatus

func (sp *Span) SetStatus(code codes.Code, description string)

func (*Span) SetTag

func (sp *Span) SetTag(key string, val interface{})

func (*Span) Span

func (sp *Span) Span() trace.Span

func (*Span) SpanContext

func (sp *Span) SpanContext() trace.SpanContext

func (*Span) SpanID

func (sp *Span) SpanID() string

func (*Span) TraceID

func (sp *Span) TraceID() string

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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