internal

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const OperationNameContextKey contextKey = 0

OperationNameContextKey specifies the operation name location within the context for instrumentation.

Variables

This section is empty.

Functions

func TimeRequest

func TimeRequest(ctx context.Context, operation string, coll instrument.Collector, client Requester, request *http.Request) (*http.Response, error)

TimeRequest performs an HTTP client request and records the duration in a histogram.

func TimeRequestHistogram

func TimeRequestHistogram(ctx context.Context, operation string, metric *prometheus.HistogramVec, client Requester, request *http.Request) (*http.Response, error)

TimeRequestHistogram performs an HTTP client request and records the duration in a histogram. Deprecated: try to use TimeRequest() to avoid creation of a collector on every request

Types

type Requester

type Requester interface {
	Do(req *http.Request) (*http.Response, error)
}

Requester executes an HTTP request.

type TimedClient

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

TimedClient instruments a request. It implements Requester.

func NewTimedClient

func NewTimedClient(client Requester, collector instrument.Collector) *TimedClient

NewTimedClient creates a Requester that instruments requests on `client`.

func (TimedClient) Do

func (c TimedClient) Do(r *http.Request) (*http.Response, error)

Do executes the request.

Jump to

Keyboard shortcuts

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