Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRoundTripper ¶
func NewRoundTripper(original http.RoundTripper, opts ...TrarelicOption) http.RoundTripper
NewRoundTripper creates http.RoundTripper to instrument external requests. The RoundTripper returned creates an external span with tags (or use existed one) before delegating to the original RoundTripper provided (or http.DefaultTransport if none is provided).
Types ¶
type Trarelic ¶
type Trarelic struct { Tracer opentracing.Tracer NewSpan bool Type string Caller string Postfix string }
func NewTrarelic ¶
func NewTrarelic(opts ...TrarelicOption) *Trarelic
NewTrarelic is a constructor function for *Trarelic.
func (*Trarelic) GetSpanFromRequest ¶
GetSpanFromRequest returns span to witch trarelic's tags will be applied.
type TrarelicOption ¶
type TrarelicOption func(*Trarelic)
func WithCaller ¶
func WithCaller(caller string) TrarelicOption
WithCaller defines caller of the external request, defaults to path of binary executable.
func WithNewSpan ¶
func WithNewSpan(new bool) TrarelicOption
WithNewSpan defines whether new span for external request is needed, defaults to true.
func WithPostfix ¶
func WithPostfix(postfix string) TrarelicOption
WithPostfix redefines new span name to custom one by adding postfix to external url host. Can be useful in two cases: 1. we need to segregate external requests within one external host, e.g. payout / payout status, etc. 2. external host is not human-readable and custom name is more preferable, e.g. ip
func WithTracer ¶
func WithTracer(tracer opentracing.Tracer) TrarelicOption
WithTracer defines certain tracer implementation, if needed, defaults to opentracing.GlobalTracer().
func WithType ¶
func WithType(tp string) TrarelicOption
WithType is a newrelic style segmentation by type (background / web), defaults to background.