Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithSpan(ctx context.Context, sc Span) context.Context
- func InitGlobalTracer(tracer Tracer)
- func Inject(sc SpanContext, format interface{}, carrier interface{}) error
- func IsGlobalTracerRegistered() bool
- func Log(ctx context.Context, data LogData)
- func SetGlobalTracer(tracer Tracer)
- type BuiltinFormat
- type Extractor
- type FinishSpanOption
- type HTTPHeaderExtractSpanContext
- type HTTPHeadersCarrier
- type HTTPHeadersExtractor
- type HTTPHeadersInjector
- type Injector
- type LogData
- type PropagatorConfig
- type SampleStrategy
- type Span
- func GetSpanFromContext(ctx context.Context) Span
- func StartClientSpan(operationName string, opts ...StartSpanOption) Span
- func StartClientSpanFromContext(ctx context.Context, operationName string, opts ...StartSpanOption) (Span, context.Context)
- func StartServerSpan(operationName string, opts ...StartSpanOption) Span
- func StartServerSpanFromContext(ctx context.Context, operationName string, opts ...StartSpanOption) (Span, context.Context)
- func StartSpan(operationName string, opts ...StartSpanOption) Span
- func StartSpanFromContext(ctx context.Context, operationName string, opts ...StartSpanOption) (Span, context.Context)
- type SpanContext
- type StartSpanConfig
- type StartSpanOption
- type Tracer
- type TracerConfig
- type TracerOption
- func WithLogSender(enable bool) TracerOption
- func WithLogger(logger logger.Logger) TracerOption
- func WithMetrics(enable bool) TracerOption
- func WithMetricsAddress(metricAddress string) TracerOption
- func WithPropagator(format interface{}, injector Injector, extractor Extractor) TracerOption
- func WithSenderChanSize(chanSize int) TracerOption
- func WithSenderNumber(senderNumber int) TracerOption
- func WithSenderSock(senderSock string) TracerOption
- func WithService(serviceType string, service string) TracerOption
Constants ¶
View Source
const ( Web = "web" Http = "http" RPC = "rpc" GRPC = "grpc" MySQL = "mysql" Redis = "redis" Kafka = "kafka" )
View Source
const ( LogLevelTrace = "trace" LogLevelDebug = "debug" LogLevelInfo = "info" LogLevelWarn = "warn" LogLevelError = "error" LogLevelFatal = "fatal" )
Variables ¶
View Source
var ( ErrUnsupportedFormat = errors.New("Unknown or unsupported Inject/Extract format") ErrInvalidCarrier = errors.New("Invalid Inject/Extract carrier") )
Functions ¶
func InitGlobalTracer ¶
func InitGlobalTracer(tracer Tracer)
func Inject ¶
func Inject(sc SpanContext, format interface{}, carrier interface{}) error
func IsGlobalTracerRegistered ¶
func IsGlobalTracerRegistered() bool
func SetGlobalTracer ¶
func SetGlobalTracer(tracer Tracer)
Types ¶
type Extractor ¶
type Extractor interface {
Extract(carrier interface{}) (SpanContext, error)
}
type FinishSpanOption ¶
type HTTPHeaderExtractSpanContext ¶
type HTTPHeaderExtractSpanContext struct {
// contains filtered or unexported fields
}
func (*HTTPHeaderExtractSpanContext) ForeachBaggageItem ¶
func (sc *HTTPHeaderExtractSpanContext) ForeachBaggageItem(h func(string, string) bool)
func (*HTTPHeaderExtractSpanContext) Sample ¶
func (sc *HTTPHeaderExtractSpanContext) Sample() (SampleStrategy, int)
func (*HTTPHeaderExtractSpanContext) SpanID ¶
func (sc *HTTPHeaderExtractSpanContext) SpanID() string
func (*HTTPHeaderExtractSpanContext) TraceID ¶
func (sc *HTTPHeaderExtractSpanContext) TraceID() string
type HTTPHeadersCarrier ¶
func (HTTPHeadersCarrier) ForeachKey ¶
func (c HTTPHeadersCarrier) ForeachKey(handler func(key, val string) error) error
func (HTTPHeadersCarrier) Set ¶
func (c HTTPHeadersCarrier) Set(key, val string)
type HTTPHeadersExtractor ¶
type HTTPHeadersExtractor struct { }
func (*HTTPHeadersExtractor) Extract ¶
func (extractor *HTTPHeadersExtractor) Extract(carrier interface{}) (SpanContext, error)
type HTTPHeadersInjector ¶
type HTTPHeadersInjector struct { }
func (*HTTPHeadersInjector) Inject ¶
func (injector *HTTPHeadersInjector) Inject(sc SpanContext, carrier interface{}) error
type Injector ¶
type Injector interface {
Inject(sc SpanContext, carrier interface{}) error
}
type PropagatorConfig ¶
type SampleStrategy ¶
type SampleStrategy byte
const ( SampleStrategyUnknown SampleStrategy = iota SampleStrategyNotSampled SampleStrategySampled )
type Span ¶
type Span interface { Finish() FinishWithOption(opt FinishSpanOption) Context() SpanContext SetBaggageItem(restrictedKey, value string) Span BaggageItem(restrictedKey string) string SetTag(key string, value interface{}) Span SetTagString(key string, value string) Span SetTagFloat64(key string, value float64) Span SetTagInt64(key string, value int64) Span }
func GetSpanFromContext ¶
func StartClientSpan ¶
func StartClientSpan(operationName string, opts ...StartSpanOption) Span
func StartServerSpan ¶
func StartServerSpan(operationName string, opts ...StartSpanOption) Span
func StartSpan ¶
func StartSpan(operationName string, opts ...StartSpanOption) Span
func StartSpanFromContext ¶
type SpanContext ¶
type SpanContext interface { TraceID() string SpanID() string Sample() (strategy SampleStrategy, weight int) ForeachBaggageItem(func(string, string) bool) }
func Extract ¶
func Extract(format interface{}, carrier interface{}) (SpanContext, error)
type StartSpanConfig ¶
type StartSpanOption ¶
type StartSpanOption func(*StartSpanConfig)
func ChildOf ¶
func ChildOf(sc SpanContext) StartSpanOption
func ClientResourceAs ¶
func ClientResourceAs(clientServiceType string, clientService string, clientResource string) StartSpanOption
func ServerResourceAs ¶
func ServerResourceAs(resource string) StartSpanOption
type Tracer ¶
type Tracer interface { Start() Extract(format interface{}, carrier interface{}) (SpanContext, error) Inject(sc SpanContext, format interface{}, carrier interface{}) error StartServerSpan(operationName string, opts ...StartSpanOption) Span StartServerSpanFromContext(ctx context.Context, operationName string, opts ...StartSpanOption) (Span, context.Context) StartClientSpan(operationName string, opts ...StartSpanOption) Span StartClientSpanFromContext(ctx context.Context, operationName string, opts ...StartSpanOption) (Span, context.Context) StartSpan(operationName string, opts ...StartSpanOption) Span StartSpanFromContext(ctx context.Context, operationName string, opts ...StartSpanOption) (Span, context.Context) Log(ctx context.Context, data LogData) Stop() }
func GlobalTracer ¶
func GlobalTracer() Tracer
func NewTracer ¶
func NewTracer(serviceType, service string, opts ...TracerOption) Tracer
type TracerConfig ¶
type TracerConfig struct { ServiceType string Service string SenderChanSize int SenderSock string SenderNumber int Logger logger.Logger EnableMetric bool MetricSock string EnableLogSender bool LogSenderSock string LogSenderNumber int LogSenderChanSize int SettingsFetcherSock string PropagatorConfigs []PropagatorConfig ServerRegisterSock string }
type TracerOption ¶
type TracerOption func(*TracerConfig)
func WithLogSender ¶
func WithLogSender(enable bool) TracerOption
func WithLogger ¶
func WithLogger(logger logger.Logger) TracerOption
func WithMetrics ¶
func WithMetrics(enable bool) TracerOption
func WithMetricsAddress ¶
func WithMetricsAddress(metricAddress string) TracerOption
func WithPropagator ¶
func WithPropagator(format interface{}, injector Injector, extractor Extractor) TracerOption
func WithSenderChanSize ¶
func WithSenderChanSize(chanSize int) TracerOption
func WithSenderNumber ¶
func WithSenderNumber(senderNumber int) TracerOption
func WithSenderSock ¶
func WithSenderSock(senderSock string) TracerOption
func WithService ¶
func WithService(serviceType string, service string) TracerOption
Source Files ¶
Click to show internal directories.
Click to hide internal directories.