client

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 5 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.

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.

func (TimedClient) RoundTrip

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

RoundTrip implements the RoundTripper interface.

Jump to

Keyboard shortcuts

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