Documentation ¶
Overview ¶
Package httpclient provides an instrumented HTTP client with the addition of the traceID header and logging.
Index ¶
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 wraps the default HTTP client functionalities and adds logging and instrumentation capabilities.
type InstrumentRoundTripper ¶
type InstrumentRoundTripper func(next http.RoundTripper) http.RoundTripper
InstrumentRoundTripper is an alias for a RoundTripper function.
type Option ¶
type Option func(c *Client)
Option is the interface that allows to set client options.
func WithComponent ¶
WithComponent sets the component name to be used in logs.
func WithLogPrefix ¶
WithLogPrefix specifies a string prefix to be added to each log field name in the Do method.
func WithRedactFn ¶
WithRedactFn set the function used to redact HTTP request and response dumps in the logs.
func WithRoundTripper ¶
func WithRoundTripper(fn InstrumentRoundTripper) Option
WithRoundTripper wraps the HTTP client Transport with the specified RoundTripper function.
func WithTimeout ¶
WithTimeout overrides the default client timeout.
func WithTraceIDHeaderName ¶
WithTraceIDHeaderName sets the trace id header name.