Documentation ¶
Index ¶
- Constants
- Variables
- func Handler(tracer opentracing.Tracer, inner http.Handler) http.Handlerdeprecated
- func NewJaeger(serviceName string, opts ...TraceOption) (opentracing.Tracer, io.Closer)
- func Noop() (opentracing.Tracer, io.Closer)
- func OnError(span opentracing.Span, err error)
- func OnPanic(span opentracing.Span, panicErr interface{})
- func ResourceNameOption(resourceName string) opentracing.StartSpanOption
- func SetResourceName(span opentracing.Span, resourceName string)
- func SetTagAndBaggage(span opentracing.Span, baggageKey, baggageValue string) error
- func SetTagFromBaggage(span opentracing.Span, baggageKey string) error
- func WithSpan(ctx context.Context, action func(span opentracing.Span))
- type TraceOption
Constants ¶
const ErrorDomainTagKey = "error.domain"
ErrorDomainTagKey indicates that tag key to use for error domain
const ErrorReasonTagKey = "error.reason"
ErrorReasonTagKey indicates that tag key to use for error reason
const RetryEventTagKey = "retry.event"
RetryEventTagKey is used to tag the number of retry in kafka receiver
Variables ¶
var ( GRPCSpanOption = opentracing.Tag{Key: "span.type", Value: "rpc"} // LogEventTag represents trace event type tag LogEventTag = fields.StringTagName("event") // LogMessageTag represents trace message tag LogMessageTag = fields.StringTagName("message") )
var PanicTagKey = "error.panic"
PanicTagKey indicates the tag key to use for panic
Functions ¶
func Handler
deprecated
Handler can be used to wrap an http.Handler into one that also handles tracing. To use it create a ddtracer ( e.g. opentracing.GlobalTracer() ) and pass it with the original handler.
Deprecated: Refer to http.ServerTracingMiddleware
func NewJaeger ¶
func NewJaeger(serviceName string, opts ...TraceOption) (opentracing.Tracer, io.Closer)
NewJaeger creates a new opentracing.Tracer that uses Jaeger serviceName should be set based on the name provided in the configuration
func OnError ¶
func OnError(span opentracing.Span, err error)
OnError marks span as error and adds log records
func OnPanic ¶
func OnPanic(span opentracing.Span, panicErr interface{})
OnPanic applies default tags and log fields to the span
func ResourceNameOption ¶
func ResourceNameOption(resourceName string) opentracing.StartSpanOption
ResourceNameOption return a start span option with updated resource name
func SetResourceName ¶
func SetResourceName(span opentracing.Span, resourceName string)
SetResourceName updates the resource name of the span
func SetTagAndBaggage ¶
SetTagAndBaggage sets a Tag and a Baggage item on the provided span.
func SetTagFromBaggage ¶
SetTagFromBaggage sets a Tag on the Span using a baggage item value. This is useful when propagating a tag from a service to another. It can be used within the same service too.
Types ¶
type TraceOption ¶
type TraceOption func(options *traceOptions)
TraceOption represents
func MetricEndpoint ¶
func MetricEndpoint(host string, port string) TraceOption
MetricEndpoint metric endpoint specifies the host and port to use to for metric data
func TraceEndpoint ¶
func TraceEndpoint(host string, port string) TraceOption
TraceEndpoint specifies the host and port to use to for metric data