wrap

package
v1.72.0-dev.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(h http.Handler, service, resource string, opts ...config.Option) http.Handler

Handler wraps an http.Handler with tracing using the given service and resource. If the WithResourceNamer option is provided as part of opts, it will take precedence over the resource argument.

func TraceAndServe

func TraceAndServe(h http.Handler, w http.ResponseWriter, r *http.Request, cfg *httptrace.ServeConfig)

TraceAndServe serves the handler h using the given ResponseWriter and Request, applying tracing according to the specified config.

Types

type ServeMux

type ServeMux struct {
	*http.ServeMux
	// contains filtered or unexported fields
}

ServeMux is an HTTP request multiplexer that traces all the incoming requests.

func NewServeMux

func NewServeMux(opts ...config.Option) *ServeMux

NewServeMux allocates and returns an http.ServeMux augmented with the global tracer.

func (*ServeMux) ServeHTTP

func (mux *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP dispatches the request to the handler whose pattern most closely matches the request URL. We only need to rewrite this function to be able to trace all the incoming requests to the underlying multiplexer

type WrappedHandler

type WrappedHandler struct {
	http.HandlerFunc
}

Jump to

Keyboard shortcuts

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