Documentation ¶
Overview ¶
实现文件 jaegertracing 基于 jaeger 实现的分布式追踪服务
接口文件 tracer 分布式追踪服务
Index ¶
- Constants
- Variables
- func ClientInterceptor(tracer opentracing.Tracer) grpc.UnaryClientInterceptor
- func NewSlowReporter(sender jaeger.Transport, metrics *jaeger.Metrics, probabilistic float64) jaeger.Reporter
- func ServerInterceptor(tracer opentracing.Tracer) grpc.UnaryServerInterceptor
- type EchoTracer
- type ISpan
- type ITracer
- type MDReaderWriter
- type Option
- func WithHTTP(CollectorEndpoint string) Option
- func WithProbabilistic(probabilistic float64) Option
- func WithSamplerType(samplertype string) Option
- func WithServiceName(name string) Option
- func WithSlowRequest(ms int) Option
- func WithSlowSpan(ms int) Option
- func WithSpanFactory(factory ...TracerFactory) Option
- func WithUDP(LocalAgentHostPort string) Option
- type Parm
- type RedisTracer
- type SpanFactory
- type TraceKey
- type TracerFactory
Constants ¶
View Source
const (
// EchoSpan echo span
EchoSpan = "tracer_span_echo"
)
View Source
const (
// Name module name
Name = "JaegerTracing"
)
View Source
const (
// RedisSpan redis span
RedisSpan = "tracer_span_redis"
)
Variables ¶
View Source
var ( // ErrFactoryNotExist factory not exist ErrFactoryNotExist = errors.New("factory not exist") )
Functions ¶
func ClientInterceptor ¶
func ClientInterceptor(tracer opentracing.Tracer) grpc.UnaryClientInterceptor
ClientInterceptor rpc拦截器
func NewSlowReporter ¶
func NewSlowReporter(sender jaeger.Transport, metrics *jaeger.Metrics, probabilistic float64) jaeger.Reporter
NewSlowReporter creates a new reporter that sends spans out of process by means of Sender.
func ServerInterceptor ¶
func ServerInterceptor(tracer opentracing.Tracer) grpc.UnaryServerInterceptor
ServerInterceptor server端rpc拦截器
Types ¶
type EchoTracer ¶
type EchoTracer struct {
// contains filtered or unexported fields
}
EchoTracer http request tracer
func (*EchoTracer) GetID ¶
func (t *EchoTracer) GetID() string
func (*EchoTracer) SetTag ¶
func (t *EchoTracer) SetTag(key string, val interface{})
type ISpan ¶
type ISpan interface { Begin(ctx interface{}) SetTag(key string, val interface{}) GetID() string End(ctx interface{}) }
ISpan span interface
type MDReaderWriter ¶
MDReaderWriter metadata 读写
func (MDReaderWriter) ForeachKey ¶
func (c MDReaderWriter) ForeachKey(handler func(key, val string) error) error
ForeachKey 为了 opentracing.TextMapReader ,参考 opentracing 代码
func (MDReaderWriter) Set ¶
func (c MDReaderWriter) Set(key, val string)
Set 为了 opentracing.TextMapWriter,参考 opentracing 代码
type Option ¶
type Option func(*Parm)
Option config wraps
func WithHTTP ¶
WithHTTP http://172.17.0.1:14268/api/traces
func WithProbabilistic ¶
WithProbabilistic 采样率 0 ~ 1
func WithServiceName ¶
func WithSpanFactory ¶
func WithSpanFactory(factory ...TracerFactory) Option
type Parm ¶
type Parm struct { Name string CollectorEndpoint string // jaeger http地址 LocalAgentHostPort string // jaeger udp地址 Probabilistic float64 // 采样率 SamplerType string SlowRequest time.Duration // 一旦request超出设置的SlowRequest(ms)时间,则一定会有一条slow日志 SlowSpan time.Duration // 一旦span超出设置的SlowSpan(ms)时间,则一定会有一条slow日志 ImportFactory []TracerFactory }
Parm https://github.com/jaegertracing/jaeger-client-go/blob/master/config/config.go
type RedisTracer ¶
type RedisTracer struct { Cmd string // contains filtered or unexported fields }
RedisTracer redis tracer
func (*RedisTracer) GetID ¶
func (r *RedisTracer) GetID() string
func (*RedisTracer) SetTag ¶
func (r *RedisTracer) SetTag(key string, val interface{})
type SpanFactory ¶
SpanFactory span 工厂
func CreateEchoTraceSpan ¶
func CreateEchoTraceSpan() SpanFactory
createEchoTraceSpan 构建 echo tracer
func CreateRedisSpanFactory ¶
func CreateRedisSpanFactory() SpanFactory
type TracerFactory ¶
type TracerFactory struct { Name string Factory SpanFactory }
Click to show internal directories.
Click to hide internal directories.