Versions in this module Expand all Collapse all v1 v1.0.0 Dec 5, 2022 Changes in this version + const GrpcErrorCode + const HttpErrorCode + const KratosTraceDebug + const KratosTraceID + const LogErrorKind + const LogErrorObject + const LogEvent + const LogMessage + const LogStack + const MqErrorCode + const ResultCode + const Resultdesc + const RtspErrorCode + const SuccCode + const TagAddress + const TagAnnotation + const TagComment + const TagComponent + const TagDBInstance + const TagDBStatement + const TagDBType + const TagDBUser + const TagError + const TagHTTPMethod + const TagHTTPStatusCode + const TagHTTPURL + const TagMessageBusDestination + const TagPeerAddress + const TagPeerHostname + const TagPeerIPv4 + const TagPeerIPv6 + const TagPeerPort + const TagPeerService + const TagRTSPURL + const TagSamplingPriority + const TagSpanKind + const XB3_Parentspanid + const XB3_Parentspanid_Upper + const XB3_Simple + const XB3_Simple_Upper + const XB3_Spanid + const XB3_Spanid_Upper + const XB3_TraceID + const XB3_TraceID_Upper + const ZipkinCaller + const ZipkinObject + const ZipkinUserAgent + const Zipkin_Code + const Zipkin_Desc + const Zipkin_error + const Zipkin_info + var ErrInvalidCarrier = errs.New("trace: Invalid Inject/Extract carrier") + var ErrInvalidTrace = errs.New("trace: Trace type incompatible with tracer") + var ErrTraceCorrupted = errs.New("trace: Trace data corrupted in Extract carrier") + var ErrTraceNotFound = errs.New("trace: Trace not found in Extract carrier") + var ErrUnsupportedFormat = errs.New("trace: Unknown or unsupported Inject/Extract format") + func Close() error + func Init(cfg *Config) + func Inject(t Trace, format interface{}, carrier interface{}) error + func NewContext(ctx context.Context, t Trace) context.Context + func NewContextRespond(ctx context.Context, t TResponder) context.Context + func SetGlobalTracer(tracer Tracer) + type BuiltinFormat byte + const GRPCFormat + const HTTPFormat + const RTSPFormat + const TextFormat + type Carrier interface + Get func(key string) string + Set func(key, val string) + type Config struct + Addr string + DisableSample bool + Network string + Probability float32 + ProtocolVersion int32 + Timeout xtime.Duration + type LogField struct + Key string + Value string + func Log(key string, val string) LogField + type Option func(*option) + func EnableDebug() Option + func SetSample(sample bool) Option + type Respond struct + Code string + Codedesc string + Error error + Respond bool + func (s *Respond) GetCode() string + func (s *Respond) GetCodeDesc() string + func (s *Respond) GetErrorMsg() string + func (s *Respond) GetRespond() bool + func (s *Respond) SetCode(code string) + func (s *Respond) SetCodeDesc(codedesc string) + func (s *Respond) SetError(err error) + func (s *Respond) SetRespond(b bool) + type Span struct + func (s *Span) Context() spanContext + func (s *Span) Duration() time.Duration + func (s *Span) Finish(perr *error) + func (s *Span) Follow(serviceName, operationName string) Trace + func (s *Span) Fork(serviceName, operationName string) Trace + func (s *Span) Logs() []*protogen.Log + func (s *Span) OperationName() string + func (s *Span) ServiceName() string + func (s *Span) SetLog(logs ...LogField) Trace + func (s *Span) SetStartTime(now time.Time) + func (s *Span) SetTag(tags ...Tag) Trace + func (s *Span) SetTitle(operationName string) + func (s *Span) StartTime() time.Time + func (s *Span) String() string + func (s *Span) Tags() []Tag + func (s *Span) TraceID() string + func (s *Span) Visit(fn func(k, v string)) + type TResponder interface + GetCode func() string + GetCodeDesc func() string + GetRespond func() bool + SetCode func(string) + SetCodeDesc func(string) + SetRespond func(bool) + func FindRespond(ctx context.Context) (t TResponder, ok bool) + type Tag struct + Key string + Value interface{} + func Bool(key string, val bool) Tag + func Int(key string, val int) Tag + func String(key string, val string) Tag + func TagBool(key string, val bool) Tag + func TagFloat32(key string, val float32) Tag + func TagFloat64(key string, val float64) Tag + func TagInt(key string, val int) Tag + func TagInt64(key string, val int64) Tag + func TagInterface(key string, val interface{}) Tag + func TagString(key string, val string) Tag + type Trace interface + Finish func(err *error) + Follow func(serviceName, operationName string) Trace + Fork func(serviceName, operationName string) Trace + SetLog func(logs ...LogField) Trace + SetStartTime func(now time.Time) + SetTag func(tags ...Tag) Trace + SetTitle func(title string) + TraceID func() string + Visit func(fn func(k, v string)) + func Extract(format interface{}, carrier interface{}) (Trace, error) + func FromContext(ctx context.Context) (t Trace, ok bool) + func New(operationName string, opts ...Option) Trace + type Tracer interface + Extract func(format interface{}, carrier interface{}) (Trace, error) + Inject func(t Trace, format interface{}, carrier interface{}) error + New func(operationName string, opts ...Option) Trace + func NewTracer(serviceName string, report reporter, disableSample bool) Tracer + func TracerFromEnvFlag() (Tracer, error)