tracing

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 11 Imported by: 21

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.

func Disable

func Disable() nirvana.Configurer

Disable returns a configurer to disable tracing.

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.

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