Documentation ¶
Index ¶
- func DiscardSpanInContext(ctx context.Context) context.Context
- func ExtractSpanContextFromEnv(envs []string) (opentracing.SpanContext, error)
- func IsSampled(ctx context.Context) bool
- func StartSpan(ctx context.Context, spanName string, tags Tags, ...) (opentracing.Span, context.Context)
- func StartSpanIfHasParent(ctx context.Context, spanName string, tags Tags, ...) (opentracing.Span, context.Context)
- func StreamPassthroughInterceptor(spanContext opentracing.SpanContext) grpc.StreamClientInterceptor
- func UnaryPassthroughInterceptor(spanContext opentracing.SpanContext) grpc.UnaryClientInterceptor
- type NoopSpan
- func (s *NoopSpan) BaggageItem(string) string
- func (s *NoopSpan) Context() opentracing.SpanContext
- func (s *NoopSpan) Finish()
- func (s *NoopSpan) FinishWithOptions(_ opentracing.FinishOptions)
- func (s *NoopSpan) Log(opentracing.LogData)
- func (s *NoopSpan) LogEvent(string)
- func (s *NoopSpan) LogEventWithPayload(string, interface{})
- func (s *NoopSpan) LogFields(...log.Field)
- func (s *NoopSpan) LogKV(...interface{})
- func (s *NoopSpan) SetBaggageItem(string, string) opentracing.Span
- func (s *NoopSpan) SetOperationName(string) opentracing.Span
- func (s *NoopSpan) SetTag(string, interface{}) opentracing.Span
- func (s *NoopSpan) Tracer() opentracing.Tracer
- type NoopSpanContext
- type NoopTracer
- type Tags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscardSpanInContext ¶
DiscardSpanInContext discards the current active span from the context. This function is helpful when the current code path enters an area shared by other code paths. Git catfile cache is a good example of this type of span.
func ExtractSpanContextFromEnv ¶
ExtractSpanContextFromEnv extracts a SpanContext from the environment variable list. The caller usually passes the result of os.Environ() into this method.
func StartSpan ¶
func StartSpan(ctx context.Context, spanName string, tags Tags, opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context)
StartSpan creates a new span with name and options (mostly tags). This function is a wrapper for underlying tracing libraries. This method should only be used at the entrypoint of the program.
func StartSpanIfHasParent ¶
func StartSpanIfHasParent(ctx context.Context, spanName string, tags Tags, opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context)
StartSpanIfHasParent creates a new span if the context already has an existing span. This function adds a simple validation to prevent orphan spans outside interested code paths. It returns a dummy span, which acts as normal span, but does absolutely nothing and is not recorded later.
func StreamPassthroughInterceptor ¶
func StreamPassthroughInterceptor(spanContext opentracing.SpanContext) grpc.StreamClientInterceptor
StreamPassthroughInterceptor is equivalent to UnaryPassthroughInterceptor, but for streaming gRPC calls.
func UnaryPassthroughInterceptor ¶
func UnaryPassthroughInterceptor(spanContext opentracing.SpanContext) grpc.UnaryClientInterceptor
UnaryPassthroughInterceptor is a client gRPC unary interceptor that rewrites a span context into the outgoing metadata of the call. It is useful for intermediate systems who don't want to start new spans.
Types ¶
type NoopSpan ¶
type NoopSpan struct{}
NoopSpan is a dummy span implementing opentracing.Span interface. All data setting functions do nothing. Data getting functions return other dummy objects. Spans of this kind are not recorded later.
func (*NoopSpan) BaggageItem ¶
func (*NoopSpan) FinishWithOptions ¶
func (s *NoopSpan) FinishWithOptions(_ opentracing.FinishOptions)
func (*NoopSpan) LogEventWithPayload ¶
func (*NoopSpan) SetBaggageItem ¶
func (*NoopSpan) SetOperationName ¶
type NoopSpanContext ¶
type NoopSpanContext struct{}
NoopSpanContext is a dummy context returned by NoopSpan
func (NoopSpanContext) ForeachBaggageItem ¶
func (n NoopSpanContext) ForeachBaggageItem(func(k string, v string) bool)
type NoopTracer ¶
type NoopTracer struct{}
NoopTracer is a dummy tracer returned by NoopSpan
func (NoopTracer) Extract ¶
func (n NoopTracer) Extract(interface{}, interface{}) (opentracing.SpanContext, error)
func (NoopTracer) Inject ¶
func (n NoopTracer) Inject(opentracing.SpanContext, interface{}, interface{}) error
func (NoopTracer) StartSpan ¶
func (n NoopTracer) StartSpan(string, ...opentracing.StartSpanOption) opentracing.Span