Documentation
¶
Overview ¶
Package httpclient provides an instrumented HTTP client for APM monitoring. It wraps the standard http.Client and dispatches events for outgoing requests.
Index ¶
- type Client
- func (c *Client) Delete(ctx context.Context, url string) (*http.Response, error)
- func (c *Client) Do(ctx context.Context, req *http.Request) (*http.Response, error)
- func (c *Client) Get(ctx context.Context, url string) (*http.Response, error)
- func (c *Client) Patch(ctx context.Context, url string, contentType string, body io.Reader) (*http.Response, error)
- func (c *Client) Post(ctx context.Context, url string, contentType string, body io.Reader) (*http.Response, error)
- func (c *Client) Put(ctx context.Context, url string, contentType string, body io.Reader) (*http.Response, error)
- func (c *Client) SetEventDispatcher(fn func(event interface{}) error)
- type Option
- type RequestFailed
- type RequestSent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an instrumented HTTP client that dispatches events for APM monitoring
func (*Client) Patch ¶
func (c *Client) Patch(ctx context.Context, url string, contentType string, body io.Reader) (*http.Response, error)
Patch performs a PATCH request
func (*Client) Post ¶
func (c *Client) Post(ctx context.Context, url string, contentType string, body io.Reader) (*http.Response, error)
Post performs a POST request
func (*Client) Put ¶
func (c *Client) Put(ctx context.Context, url string, contentType string, body io.Reader) (*http.Response, error)
Put performs a PUT request
func (*Client) SetEventDispatcher ¶ added in v0.9.11
SetEventDispatcher sets the function used to dispatch events.
type Option ¶
type Option func(*Client)
Option configures a Client
func WithBaseURL ¶
WithBaseURL sets a base URL for all requests
func WithHTTPClient ¶
WithHTTPClient sets a custom http.Client
func WithTimeout ¶
WithTimeout sets the client timeout
type RequestFailed ¶
type RequestFailed struct {
Context context.Context
Method string
URL string
Error string
DurationMs int64
TraceID string
SpanID string
ParentID string
}
RequestFailed is dispatched when an HTTP request fails
Click to show internal directories.
Click to hide internal directories.