tracing

package
v0.0.0-...-b67c3ce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

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.

func Disable

func Disable() nirvana.Configurer

Disable returns a configurer to disable tracing.

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.

func NewDefaultOption

func NewDefaultOption() *Option

NewDefaultOption creates default option.

func (*Option) Configure

func (p *Option) Configure(cfg *nirvana.Config) error

Configure configures nirvana config via current options.

func (*Option) Name

func (p *Option) Name() string

Name returns plugin name.

Directories

Path Synopsis
clients

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL