Documentation ¶
Index ¶
- func GoWithRecover(traceCtx context.Context, serviceName string, fn Executor, options ...Option)
- func GoWithRecoverOnce(traceCtx context.Context, serviceName string, fn Executor, options ...Option)
- func GoWithRecoverResident(traceCtx context.Context, serviceName string, fn Executor, options ...Option)
- type Executor
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoWithRecover ¶
创建一个goroutine,执行fn() 如果发生panic,在retry次数内,会sleep一个interval周期后,重新开启新的goroutine
traceCtx:与链路追踪相关的上下文,这个上下文仅用来链接到caller,随后会被销毁
如果你需要使用context的特性,请使用WithContext() 当然,你可以传递traceCtx,即WithContext(traceCtx)
serviceName:服务名,对应链路追踪的span name
Types ¶
type Executor ¶
Executor是goroutine的真正执行者 ctx:一个自定义的上下文,并附加链路追踪的信息 span:你可以通过span记录更多的信息
注意:ctx与下面的traceCtx是不同的
type Option ¶
type Option func(*config)
func WithTracer ¶
func WithTracer(tracer opentracing.Tracer) Option
Click to show internal directories.
Click to hide internal directories.