Documentation ¶
Index ¶
Constants ¶
View Source
const ExternalConfigName = "tracing"
ExternalConfigName is the external config name of tracing.
View Source
const (
// HeaderRequestID is request id
HeaderRequestID = "X-Request-ID"
)
Variables ¶
This section is empty.
Functions ¶
func AddHook ¶
func AddHook(hook Hook) nirvana.Configurer
AddHook returns a configurer to set request hook.
func CustomTracer ¶
func CustomTracer(tracer opentracing.Tracer) nirvana.Configurer
CustomTracer returns a configurer to set custom tracer.
func DefaultTracer ¶
func DefaultTracer(serviceName string, agentHostPort string) nirvana.Configurer
DefaultTracer returns a configurer to create default tracer by service and port.
Types ¶
type DefaultHook ¶
type DefaultHook struct{}
DefaultHook is an default hook, it will record X-Request-ID from http headers
func (*DefaultHook) After ¶
func (h *DefaultHook) After(ctx context.Context, span opentracing.Span)
After Do nothing, because HTTP response can't gets payload.
func (*DefaultHook) Before ¶
func (h *DefaultHook) Before(ctx context.Context, span opentracing.Span)
Before request processing
type Hook ¶
type Hook interface { // Exec before request processing Before(ctx context.Context, span opentracing.Span) // Exec after request processing After(ctx context.Context, span opentracing.Span) }
Hook allows you to custom information for span.
type Option ¶
type Option struct { // ServiceName is the trace service name ServiceName string // AgentHostPort instructs reporter to send spans to jaeger-agent at this address AgentHostPort string }
Option contains basic configurations of tracing.
Click to show internal directories.
Click to hide internal directories.