instrument

package
v0.0.0-release-12.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: AGPL-3.0 Imports: 11 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 with metrics. 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.

type TracedClient

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

TracedClient instruments a request with tracing. It implements Requester.

func NewTracedClient

func NewTracedClient(client Requester, tracer trace.Tracer, name string) *TracedClient

func (TracedClient) Do

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

Do executes the request.

func (TracedClient) RoundTrip

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

RoundTrip implements the RoundTripper interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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