Documentation ¶
Index ¶
Constants ¶
const (
RequestReceivedEvent = "request.received"
)
Variables ¶
This section is empty.
Functions ¶
func NewOpenTracingHooks ¶
func NewOpenTracingHooks(tracer otrace.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) *TraceHTTPClient
type TraceOption ¶
type TraceOption func(opts *TraceOptions)
func IncludeClientErrors ¶
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 ¶
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 ¶
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 ¶
type TraceOptions struct {
// contains filtered or unexported fields
}
type TraceServerHooks ¶
func (*TraceServerHooks) TwirpHooks ¶
func (t *TraceServerHooks) TwirpHooks() *twirp.ServerHooks