trace

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2021 License: MIT Imports: 6 Imported by: 0

README

go-jaeger-trace

golang基于jaeger的trace中间件

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewJaegerTracer

func NewJaegerTracer(serviceName string, jaegerHostPort string, opts ...Option) (opentracing.Tracer, io.Closer, error)

NewJaegerTracer 创建 Jaeger 链路追踪器 Args:

  • jaegerHostPort: jaeger agent 组件 IP 地址 及 端口. 例如:"127.0.0.1:6831"
  • serviceName: 服务名称

Types

type Option added in v0.2.0

type Option func(opts *jaegerTracerOptions)

func WithBufferFlushInterval added in v0.2.0

func WithBufferFlushInterval(bufferFlushInterval time.Duration) Option

WithBufferFlushInterval 强制清空、推送队列时间,对于流量不高的程序,队列可能长时间不能满,那么设置这个时间,超时可以自动推送一次。 对于高并发的情况,一般队列很快就会满的,满了后也会自动推送。默认为1秒

func WithCollectorEndpoint added in v0.2.0

func WithCollectorEndpoint(collectorEndpoint string) Option

WithCollectorEndpoint 设置 api (链路追踪数据直接上报 collector 组件) 用 Collector 就不用 agent 了

func WithDisable added in v0.2.0

func WithDisable(disable bool) Option

WithDisable 是否启动

func WithLog added in v0.2.0

func WithLog(log bool) Option

WithLog 是否开启日志

func WithReporterLogSpans added in v0.2.0

func WithReporterLogSpans(logSpans bool) Option

WithReporterLogSpans 设置 是否把 Log 也推送,span 中可以携带一些日志信息

func WithReporterQueueSize added in v0.2.0

func WithReporterQueueSize(queueSize int) Option

WithReporterQueueSize 设置 设置队列大小,存储采样的 span 信息,队列满了后一次性发送到 jaeger 后端;defaultQueueSize 默认为 100;

func WithSamplerParam added in v0.2.0

func WithSamplerParam(samplerParam float64) Option

WithSamplerParam 设置 采样率 0 - 1

func WithSamplerType added in v0.2.0

func WithSamplerType(samplerType string) Option

WithSamplerType 设置 采样方式 "const" 0或1 采样器始终对所有 tracer 做出相同的决定;要么全部采样,要么全部不采样 "probabilistic" 0.0~1.0 采样器做出随机采样决策,Param 为采样概率 "ratelimiting" N 采样器一定的恒定速率对tracer进行采样,Param=2.0,则限制每秒采集2条 "remote" 无 采样器请咨询Jaeger代理以获取在当前服务中使用的适当采样策略。

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL