http

package
v2.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultSpanNameFormatter = func(operation string, r *http.Request) string {
		return operation + r.Method + r.URL.Path
	}
	DefaultFilter = func(r *http.Request) bool {
		return !(r.Method == http.MethodGet && strings.HasPrefix(r.URL.RequestURI(), "/health"))
	}
)

Functions

func NewClient added in v2.0.4

func NewClient(ca []byte) *http.Client

NewClient with CA injection

func ServerMiddleware added in v2.0.4

func ServerMiddleware(opts ...Option) func(next http.Handler) http.Handler

ServerMiddleware perform: * telemetry log injection * measure execution time * recovery

func ServerMiddlewareAll added in v2.0.4

func ServerMiddlewareAll(opts ...Option) func(next http.Handler) http.Handler

ServerMiddlewareAll represent all essential metrics Execution order:

  • opentracing injection via nethttp.Middleware
  • recovery + measure execution time + debug log via own ServerMiddleware
  • metrics via metrics.NewHTTPMiddlewareWithOption

func UpdateClient added in v2.0.4

func UpdateClient(c *http.Client, opts ...Option) *http.Client

UpdateClient inject tracer

Types

type Option added in v2.0.4

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

Option interface used for setting optional config properties.

func WithHttpTracker added in v2.0.4

func WithHttpTracker(t metrics.HTTPTracker) Option

func WithOperation added in v2.0.4

func WithOperation(name string) Option

func WithOtelOpts added in v2.0.4

func WithOtelOpts(opts ...otelhttp.Option) Option

func WithTel added in v2.0.4

func WithTel(t *tel.Telemetry) Option

Jump to

Keyboard shortcuts

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