Opentracing tracer must be instantiated and achievable via opentracing.GlobalTracer()
or passed directly via option trarelic.WithTracer()
.
Trarelic creates opentracing span with some tags needed in pulsometer:
is_external
type
caller
You must instrument your code by wrapping the http transport used in external requests.
Wrap existing transport
client := &http.Client{
Timeout: 10 * time.Second,
Transport: trarelic.NewRoundTripper(
&http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
),
}
http.DefaultTransport will be used by default if nil is passed
client := &http.Client{
Transport: trarelic.NewRoundTripper(nil),
}
With functional options
client := &http.Client{
Transport: trarelic.NewRoundTripper(
nil,
trarelic.WithTracer(opentracing.GlobalTracer()),
trarelic.WithNewSpan(true),
trarelic.WithType("background"),
trarelic.WithCaller("bin/i_am_bin"),
trarelic.WithPostfix("additional info about the call"),
),
}
See godoc for more information.