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 BinaryCarrier
- type BinaryCarrierExtractor
- type BinaryCarrierInjector
- type BinaryExtractSpanContext
- func (sc *BinaryExtractSpanContext) ClientSampled() bool
- func (sc *BinaryExtractSpanContext) ForeachBaggageItem(f func(string, string) bool)
- func (sc *BinaryExtractSpanContext) Sample() (SampleStrategy, int)
- func (sc *BinaryExtractSpanContext) SampleFlags() SampleFlags
- func (sc *BinaryExtractSpanContext) SpanID() string
- func (sc *BinaryExtractSpanContext) TraceID() string
- type BuiltinFormat
- type ErrorInfo
- type ErrorKind
- type Extractor
- type FinishSpanOption
- type HTTPHeaderExtractSpanContext
- func (sc *HTTPHeaderExtractSpanContext) ClientSampled() bool
- func (sc *HTTPHeaderExtractSpanContext) ForeachBaggageItem(h func(string, string) bool)
- func (sc *HTTPHeaderExtractSpanContext) Sample() (SampleStrategy, int)
- func (sc *HTTPHeaderExtractSpanContext) SampleFlags() SampleFlags
- func (sc *HTTPHeaderExtractSpanContext) SpanID() string
- func (sc *HTTPHeaderExtractSpanContext) TraceID() string
- type HTTPHeadersCarrier
- type HTTPHeadersExtractor
- type HTTPHeadersInjector
- type Injector
- type LogData
- type PropagatorConfig
- type RecordConfig
- type RecordOption
- type SampleFlags
- 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 WithContextAdapter(contextAdapter func(context.Context) context.Context) TracerOption
- func WithLogSender(enable bool) TracerOption
- func WithLogSenderDebug(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 WithRuntimeMetric(enable bool) 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" Consumer = "consumer" MySQL = "mysql" Redis = "redis" Kafka = "kafka" Mongodb = "mongodb" )
View Source
const ( LogLevelTrace = "trace" LogLevelDebug = "debug" LogLevelInfo = "info" LogLevelNotice = "notice" LogLevelWarn = "warn" LogLevelError = "error" LogLevelFatal = "fatal" )
log level
View Source
const ( HttpScheme = "http.scheme" HttpMethod = "http.method" HttpHost = "http.host" HttpPath = "http.path" HttpStatusCode = "http.status_code" )
http field
View Source
const ( StatusCodeOK = 0 StatusCodeError = 1 )
View Source
const (
DbStatement = "db.statement"
)
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 BinaryCarrier ¶ added in v1.3.2
type BinaryCarrierExtractor ¶ added in v1.3.2
type BinaryCarrierExtractor struct{}
func (*BinaryCarrierExtractor) Extract ¶ added in v1.3.2
func (e *BinaryCarrierExtractor) Extract(carrier interface{}) (SpanContext, error)
type BinaryCarrierInjector ¶ added in v1.3.2
type BinaryCarrierInjector struct{}
func (*BinaryCarrierInjector) Inject ¶ added in v1.3.2
func (i *BinaryCarrierInjector) Inject(sc SpanContext, carrier interface{}) error
type BinaryExtractSpanContext ¶ added in v1.3.2
type BinaryExtractSpanContext struct {
// contains filtered or unexported fields
}
func (*BinaryExtractSpanContext) ClientSampled ¶ added in v1.3.4
func (sc *BinaryExtractSpanContext) ClientSampled() bool
func (*BinaryExtractSpanContext) ForeachBaggageItem ¶ added in v1.3.2
func (sc *BinaryExtractSpanContext) ForeachBaggageItem(f func(string, string) bool)
func (*BinaryExtractSpanContext) Sample ¶ added in v1.3.2
func (sc *BinaryExtractSpanContext) Sample() (SampleStrategy, int)
func (*BinaryExtractSpanContext) SampleFlags ¶ added in v1.3.4
func (sc *BinaryExtractSpanContext) SampleFlags() SampleFlags
func (*BinaryExtractSpanContext) SpanID ¶ added in v1.3.2
func (sc *BinaryExtractSpanContext) SpanID() string
func (*BinaryExtractSpanContext) TraceID ¶ added in v1.3.2
func (sc *BinaryExtractSpanContext) TraceID() string
type Extractor ¶
type Extractor interface {
Extract(carrier interface{}) (SpanContext, error)
}
type FinishSpanOption ¶
type HTTPHeaderExtractSpanContext ¶
type HTTPHeaderExtractSpanContext struct {
// contains filtered or unexported fields
}
func (*HTTPHeaderExtractSpanContext) ClientSampled ¶ added in v1.3.4
func (sc *HTTPHeaderExtractSpanContext) ClientSampled() bool
func (*HTTPHeaderExtractSpanContext) ForeachBaggageItem ¶
func (sc *HTTPHeaderExtractSpanContext) ForeachBaggageItem(h func(string, string) bool)
func (*HTTPHeaderExtractSpanContext) Sample ¶
func (sc *HTTPHeaderExtractSpanContext) Sample() (SampleStrategy, int)
func (*HTTPHeaderExtractSpanContext) SampleFlags ¶ added in v1.3.4
func (sc *HTTPHeaderExtractSpanContext) SampleFlags() SampleFlags
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 RecordConfig ¶ added in v1.2.0
type RecordConfig struct { ErrorKind ErrorKind RecordStack bool // record stack is expensive and is disabled by default Stack string // stack passed in. which is useful where RecordError being called is different from error occurred }
func NewDefaultRecordConfig ¶ added in v1.2.0
func NewDefaultRecordConfig() RecordConfig
type RecordOption ¶ added in v1.2.0
type RecordOption func(*RecordConfig)
func WithErrorKind ¶ added in v1.2.0
func WithErrorKind(t ErrorKind) RecordOption
func WithRecordStack ¶ added in v1.2.0
func WithRecordStack(b bool) RecordOption
func WithStack ¶ added in v1.3.2
func WithStack(stack string) RecordOption
type SampleFlags ¶ added in v1.3.4
type SampleFlags int32
SampleFlags intersects with other tracing systems, should be explicitly defined.
const ( SampleFlagsUnknown SampleFlags = -1 // SampleFlags is determined by SampleStrategy and clientSampled SampleFlagsNotSampled SampleFlags = 0 SampleFlagsClientSampled SampleFlags = 1 SampleFlagsServerSampled SampleFlags = 2 SampleFlagsClientAndServerSampled SampleFlags = 3 )
func SampleFlagsFromInt32 ¶ added in v1.3.4
func SampleFlagsFromInt32(flag int32) SampleFlags
func (SampleFlags) Sampled ¶ added in v1.3.4
func (s SampleFlags) Sampled() bool
func (SampleFlags) ToString ¶ added in v1.3.4
func (s SampleFlags) ToString() string
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 RecordError(err error, opt ...RecordOption) SetStatus(status int64) }
func GetSpanFromContext ¶
Deprecated. use aitracer.GetSpanFromContext instead
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) ClientSampled() bool SampleFlags() SampleFlags 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 LogSenderDebug bool // for safety, can not use incoming logger.Logger in LogCollector LogSenderSock string LogSenderNumber int LogSenderChanSize int EnableRuntimeMetric bool SettingsFetcherSock string PropagatorConfigs []PropagatorConfig ServerRegisterSock string ContextAdapter func(context.Context) context.Context }
type TracerOption ¶
type TracerOption func(*TracerConfig)
func WithContextAdapter ¶ added in v1.1.1
func WithContextAdapter(contextAdapter func(context.Context) context.Context) TracerOption
func WithLogSender ¶
func WithLogSender(enable bool) TracerOption
func WithLogSenderDebug ¶ added in v1.3.9
func WithLogSenderDebug(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 WithRuntimeMetric ¶ added in v1.3.0
func WithRuntimeMetric(enable bool) 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.