ginhttp

package
v0.0.0-...-2ac1337 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 LoggingWriter

type LoggingWriter struct {
	gin.ResponseWriter
	Buffer *bytes.Buffer
}

func NewLoggingWriter

func NewLoggingWriter(responseWriter gin.ResponseWriter) *LoggingWriter

func (LoggingWriter) Write

func (l LoggingWriter) Write(data []byte) (int, error)

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 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