gintracer

package
v0.0.0-...-e4af952 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mid

func Mid(tr opentracing.Tracer, trCfg *Config, opts ...MWOption) gin.HandlerFunc

func Middleware

func Middleware(tr opentracing.Tracer, options ...MWOption) gin.HandlerFunc

Middleware is a gin native version of the equivalent middleware in:

https://github.com/opentracing-contrib/go-stdlib/

Types

type Config

type Config struct {
	ServiceName    string
	ServiceVersion string
	ComponentName  string
	Tags           map[string]interface{}
	SpanFilter     func(r *http.Request) bool
}

type MWOption

type MWOption func(*mwOptions)

MWOption controls the behavior of the Middleware.

func MWComponentName

func MWComponentName(componentName string) MWOption

MWComponentName returns a MWOption that sets the component name for the server-side span.

func MWSpanFilter

func MWSpanFilter(f func(r *http.Request) bool) MWOption

MWSpanFilter returns a MWOption that filters requests from creating a span for the server-side span. Span won't be created if it returns false.

func MWSpanObserver

func MWSpanObserver(f func(span opentracing.Span, r *http.Request)) MWOption

MWSpanObserver returns a MWOption that observe the span for the server-side span.

func MWURLTagFunc

func MWURLTagFunc(f func(u *url.URL) string) MWOption

MWURLTagFunc returns a MWOption that uses given function f to set the span's http.url tag. Can be used to change the default http.url tag, eg to redact sensitive information.

func OperationNameFunc

func OperationNameFunc(f func(r *http.Request) string) MWOption

OperationNameFunc returns a MWOption that uses given function f to generate operation name for each server-side span.

Jump to

Keyboard shortcuts

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