interceptor

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ClientHandleCounter ...
	ClientHandleCounter = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "",
			Name:      "http_client_handle_total",
		}, []string{"name", "method", "path", "peer", "code"})

	// ClientHandleHistogram ...
	ClientHandleHistogram = prometheus.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: "",
		Name:      "http_client_handle_seconds",
	}, []string{"name", "method", "path", "peer"})
)

Functions

func GetStartTime

func GetStartTime(ctx context.Context) time.Time

func HeaderCarrierInterceptor

func HeaderCarrierInterceptor() (resty.RequestMiddleware, resty.ResponseMiddleware, resty.ErrorHook)

多个服务间透传参数

func LogInterceptor

func LogInterceptor(cfg *http_client_config.Config) (resty.RequestMiddleware, resty.ResponseMiddleware, resty.ErrorHook)

func MetricInterceptor

func MetricInterceptor(name, addr string, rewriter http_client_config.MetricPathRewriter) (resty.RequestMiddleware, resty.ResponseMiddleware, resty.ErrorHook)

func SetStartTimeInterceptor

func SetStartTimeInterceptor() (resty.RequestMiddleware, resty.ResponseMiddleware, resty.ErrorHook)

func TraceInterceptor deprecated

func TraceInterceptor(name string, cfg *http_client_config.Config) (resty.RequestMiddleware, resty.ResponseMiddleware, resty.ErrorHook)

Deprecated: use otel http transport

Types

This section is empty.

Jump to

Keyboard shortcuts

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