xhttp

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultClientSecondsHistogramName = "client_requests_seconds_bucket"
	DefaultClientRequestsCounterName  = "client_requests_code_total"
)

Variables

This section is empty.

Functions

func DefaultRequestsCounter

func DefaultRequestsCounter(meter metric.Meter, histogramName string) (metric.Int64Counter, error)

DefaultRequestsCounter return metric.Int64Counter for WithRequests suggest histogramName = <client/server>_requests_code_total

func DefaultSecondsHistogram

func DefaultSecondsHistogram(meter metric.Meter, histogramName string) (metric.Float64Histogram, error)

DefaultSecondsHistogram return metric.Float64Histogram for WithSeconds suggest histogramName = <client/server>_requests_seconds_bucket

func DefaultSecondsHistogramView

func DefaultSecondsHistogramView(histogramName string) metricsdk.View

DefaultSecondsHistogramView need register in sdkmetric.MeterProvider eg: view := SecondsHistogramView() mp := sdkmetric.NewMeterProvider(sdkmetric.WithView(view)) otel.SetMeterProvider(mp)

func ParseProxy

func ParseProxy(proxy string) (*url.URL, error)

Types

type Client

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

func (*Client) Do

func (x *Client) Do(ctx context.Context, request *http.Request, opts ...IDoOptions) (*http.Response, error)

type ClientOptions

type ClientOptions func(client *Client)

func WithClientOptionsCheckRedirect

func WithClientOptionsCheckRedirect(cf func(req *http.Request, via []*http.Request) error) ClientOptions

func WithClientOptionsJar

func WithClientOptionsJar(jar http.CookieJar) ClientOptions

func WithClientOptionsTimeout

func WithClientOptionsTimeout(timeout time.Duration) ClientOptions

func WithClientOptionsTransport

func WithClientOptionsTransport(transport http.RoundTripper) ClientOptions

func WithMeterProvider

func WithMeterProvider(mr metric.MeterProvider) ClientOptions

func WithTraceProvider

func WithTraceProvider(tr trace.TracerProvider) ClientOptions

type DoOptionsWithRecordSize

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

func NewDoOptionsWithRecordSize

func NewDoOptionsWithRecordSize(size uint32) *DoOptionsWithRecordSize

type IClient

type IClient interface {
	Do(ctx context.Context, request *http.Request, opts ...IDoOptions) (*http.Response, error)
}

func NewClient

func NewClient(opts ...ClientOptions) (IClient, error)

type IDoOptions

type IDoOptions interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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