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 ErrorInfo
- type ErrorKind
- type Extractor
- type FinishSpanOption
- type HTTPHeaderExtractSpanContext
- type HTTPHeadersCarrier
- type HTTPHeadersExtractor
- type HTTPHeadersInjector
- type Injector
- type LogData
- type PropagatorConfig
- type RecordConfig
- type RecordOption
- 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 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" MySQL = "mysql" Redis = "redis" Kafka = "kafka" )
View Source
const ( LogLevelTrace = "trace" LogLevelDebug = "debug" LogLevelInfo = "info" 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
View Source
const ( SdkLanguage = "sdk.language" SdkVersion = "sdk.version" )
View Source
const ( SdkLanguageGolang = "golang" GoErrorType = "go.error_type" )
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 RecordConfig ¶ added in v1.2.0
type RecordConfig struct { ErrorKind ErrorKind RecordStack bool // record stack is expensive and is disabled by default }
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
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) 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 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 WithLogger ¶
func WithLogger(logger logger.Logger) TracerOption
WithLogger set logger for sdk. DO NOT USE logrus as logger if you have hooked logrus to tracer this will cause recursive call on logrus: logrus.Info -> trace.Logger.Info -> logrus.Info
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.