trace

package
v0.0.0-...-48b9d42 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultInjectHookFunc

func DefaultInjectHookFunc(ctx context.Context) logrus.Fields

func Init

func Init(serviceName string, logger *logrus.Logger, metricsFactory metrics.Factory) opentracing.Tracer

Types

type HttpMiddleware

type HttpMiddleware struct {
	// contains filtered or unexported fields
}

func NewHttpMiddleware

func NewHttpMiddleware(tracer opentracing.Tracer, opts ...HttpOption) *HttpMiddleware

func (*HttpMiddleware) Handle

type HttpOption

type HttpOption interface {
	// contains filtered or unexported methods
}

func WithHttpComponentName

func WithHttpComponentName(componentName string) HttpOption

WithHttpComponentName set component name

func WithHttpEnable

func WithHttpEnable(enable bool) HttpOption

WithHttpEnable disable to collect trace

func WithHttpLogger

func WithHttpLogger(logger logrus.FieldLogger) HttpOption

WithHttpLogger set logger

func WithHttpOpNameFunc

func WithHttpOpNameFunc(fn func(r *http.Request) string) HttpOption

WithHttpOpNameFunc set function to get operation name for span

type InjectHook

type InjectHook struct {
	InjectFunc func(context.Context) logrus.Fields
}

func (*InjectHook) Fire

func (hook *InjectHook) Fire(entry *logrus.Entry) error

func (*InjectHook) Levels

func (hook *InjectHook) Levels() []logrus.Level

type Transport

type Transport struct {
	// The actual RoundTripper to use for the request. A nil
	// RoundTripper defaults to http.DefaultTransport.
	http.RoundTripper
	// contains filtered or unexported fields
}

Transport wraps a RoundTripper. If a request is being traced with Tracer, Transport will inject the current span into the headers, and set HTTP related tags on the span.

func NewTransport

func NewTransport(tr opentracing.Tracer, options ...TransportOption) *Transport

NewTransport return a transport for http trace

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

type TransportOption

type TransportOption func(*transportOptions)

func TransportComponentName

func TransportComponentName(componentName string) TransportOption

func TransportOperationNameFunc

func TransportOperationNameFunc(operationNameFunc func(req *http.Request) string) TransportOption

Jump to

Keyboard shortcuts

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