Documentation ¶
Overview ¶
Package ottwirp provides OpenTracing support for any Twirp server.
Index ¶
Constants ¶
const (
RequestReceivedEvent = "request.received"
)
Variables ¶
This section is empty.
Functions ¶
func NewOpenTracingHooks ¶
func NewOpenTracingHooks(tracer ot.Tracer, opts ...TraceOption) *twirp.ServerHooks
NewOpenTracingHooks provides a twirp.ServerHooks struct which records OpenTracing spans.
Types ¶
type HTTPClient ¶
HTTPClient as an interface that models *http.Client.
type TraceHTTPClient ¶
type TraceHTTPClient struct {
// contains filtered or unexported fields
}
TraceHTTPClient wraps a provided http.Client and tracer for instrumenting requests.
func NewTraceHTTPClient ¶
func NewTraceHTTPClient(client HTTPClient, tracer opentracing.Tracer, opts ...TraceOption) *TraceHTTPClient
type TraceOption ¶ added in v0.3.0
type TraceOption func(opts *TraceOptions)
func IncludeClientErrors ¶ added in v0.3.0
func IncludeClientErrors(includeClientErrors bool) TraceOption
IncludeClientErrors, if set, will report client errors (4xx) as errors in the server span. If not set, only 5xx status will be reported as erroneous.
func WithContextTags ¶ added in v0.4.2
func WithContextTags(fn func(ctx context.Context) []TraceTag) TraceOption
WithContextTags defines a function that returns set of trace tags. This is useful to extract values from the request ctx and return a set of tags that are set on the span. The function is used during the `RequestReceived` server hook.
func WithTags ¶ added in v0.4.0
func WithTags(tags ...TraceTag) TraceOption
WithTags defines tags to be added to each outoing span by default. If there is a pre-existing tag set for `key`, it is overwritten.
type TraceOptions ¶ added in v0.3.0
type TraceOptions struct {
// contains filtered or unexported fields
}
type TraceServerHooks ¶ added in v0.3.0
func (*TraceServerHooks) TwirpHooks ¶ added in v0.3.0
func (t *TraceServerHooks) TwirpHooks() *twirp.ServerHooks