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 ¶ added in v0.2.0
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 ¶ added in v0.2.0
type DefaultHook struct{}
DefaultHook is an default hook, it will record X-Request-ID from http headers
func (*DefaultHook) After ¶ added in v0.2.0
func (h *DefaultHook) After(ctx context.Context, span opentracing.Span)
After Do nothing, because HTTP response can't gets payload.
func (*DefaultHook) Before ¶ added in v0.2.0
func (h *DefaultHook) Before(ctx context.Context, span opentracing.Span)
Before request processing
type Hook ¶ added in v0.2.0
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.
func NewDefaultOption ¶ added in v0.2.0
func NewDefaultOption() *Option
NewDefaultOption creates default option.
Click to show internal directories.
Click to hide internal directories.