middleware

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHealthCheckMW

func NewHealthCheckMW(basePath string, checker HealthChecker) alice.Constructor

NewHealthCheckMW creates a new health check middleware at the specified path

func NewTracingMW added in v0.1.13

func NewTracingMW(tr opentracing.Tracer, options ...MWOption) alice.Constructor

NewTracingMW creates a new health check middleware at the specified path

Types

type HealthCheck

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

HealthCheck is a middleware that serves healthcheck information

func NewHealthCheck

func NewHealthCheck(basePath string, checker HealthChecker, next http.Handler) *HealthCheck

NewHealthCheck creates a new health check middleware at the specified path

func (*HealthCheck) ServeHTTP

func (h *HealthCheck) ServeHTTP(rw http.ResponseWriter, r *http.Request)

ServeHTTP is the middleware interface implementation

type HealthChecker

type HealthChecker func() error

HealthChecker is executed to verify health of the service.

type MWOption added in v0.1.13

type MWOption func(*mwOptions)

MWOption contols the behavior of the Middleware.

func OperationNameFunc added in v0.1.13

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.

type Tracer added in v0.1.13

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

Tracer is a middleware that traces HTTP requests

func NewTracer added in v0.1.13

func NewTracer(tr opentracing.Tracer, next http.Handler, options ...MWOption) *Tracer

NewTracer creates a new health check middleware at the specified path

func (*Tracer) ServeHTTP added in v0.1.13

func (t *Tracer) ServeHTTP(rw http.ResponseWriter, r *http.Request)

ServeHTTP is the middleware interface implementation

Jump to

Keyboard shortcuts

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