metrics

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Recorder

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

Recorder provides methods to track metrics for requests

func NewRecorder

func NewRecorder(routeForDomain func(domain string) *proxy.Route) *Recorder

NewRecorder creates a new Recorder that will use the given function to map request hostnames to routes.

func (*Recorder) Handler

func (r *Recorder) Handler() http.Handler

Handler returns a HTTP handler that will provide prometheus metrics.

func (*Recorder) TrackBadGateway

func (r *Recorder) TrackBadGateway(fn func(http.ResponseWriter, *http.Request, error)) func(http.ResponseWriter, *http.Request, error)

TrackBadGateway wraps the ErrorHandler field of httputil.ReverseProxy, recording a response with an implied 502 status code.

func (*Recorder) TrackHello

func (r *Recorder) TrackHello(fn func(*tls.ClientHelloInfo) (*tls.Certificate, error)) func(*tls.ClientHelloInfo) (*tls.Certificate, error)

TrackHello wraps the GetCertificate field of tls.Config, recording whether or not a certificate was returned.

func (*Recorder) TrackResponse

func (r *Recorder) TrackResponse(fn func(*http.Response) error) func(*http.Response) error

TrackResponse wraps the ModifyResponse field of httputil.ReverseProxy, recording the response and its HTTP status code.

Jump to

Keyboard shortcuts

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