middlewares

package
v0.0.0-...-0999c01 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogRequest

func LogRequest(nextHandler httprouter.Handle, extras ...ExtraField) httprouter.Handle

func NewDurationMetricWrapper

func NewDurationMetricWrapper(opts ...durationMetricWrapperOptsFunc) *durationMetricWrapper

func WithCollector

func WithCollector(c metrics.Collector) durationMetricWrapperOptsFunc

func WithMetricsConf

func WithMetricsConf(conf MetricsConfig) durationMetricWrapperOptsFunc

Types

type ExtraField

type ExtraField func(r *http.Request, params httprouter.Params) (string, string)

type MetricsConfig

type MetricsConfig struct {
	App                string `toml:"app" yaml:"app" env:"METRICS_APP_VALUE"`
	PrometheusHost     string `toml:"prometheus_host" yaml:"prometheus_host" env:"PROMETHEUS_HOST"`
	PrometheusUsername string `toml:"prometheus_username" yaml:"prometheus_username" env:"PROMETHEUS_USERNAME"`
	PrometheusPassword string `toml:"prometheus_password" yaml:"prometheus_password" env:"PROMETHEUS_PASSWORD"`
}

type MetricsWrapper

type MetricsWrapper interface {
	Wrapper
	MetricsHandler() httprouter.Handle
}

type Wrapper

type Wrapper interface {
	Wrap(nextHandler httprouter.Handle) httprouter.Handle
}

Jump to

Keyboard shortcuts

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