metrics

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HTTPServerOps = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "bdapi",
			Name:      "http_server_route_ops_total",
			Help:      "Number of HTTP requests served.",
		},
		[]string{"route", "response_code", "content_type"},
	)

	HTTPServerResponseTime = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: "bdapi",
		Name:      "http_server_request_duration_seconds",
		Help:      "Histogram of response time for http server handlers in seconds",
		Buckets:   buckets,
	}, []string{"route"})

	ClientResponseTime = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: "bdapi",
		Name:      "http_client_request_duration_seconds",
		Help:      "Histogram of response time for http clients in seconds",
		Buckets:   []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10},
	}, []string{"host", "method", "status_code"})
)

Functions

func ClientStatusPrinter

func ClientStatusPrinter(ctx context.Context)

func NewMiddleware

func NewMiddleware(handler http.HandlerFunc) http.HandlerFunc

func OnHTTPRequest

func OnHTTPRequest(status int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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