Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClientWithDebugMetrics ¶
type HTTPClientWithDebugMetrics struct {
// contains filtered or unexported fields
}
HTTPClientWithDebugMetrics provides HTTP client functionality with embedded tracking of debug metrics. It includes things like: - Built-in request debugging - Metrics collection - Detailed logging - Timeout debugging - Connection issue visibility
TODO_TECHDEBT(@red-0ne): Consider moving this HTTP client implementation to ShannonSDK for sharing between RelayMiner and PATH once optimizations stabilize and requirements align. For now, keeping separate implementations to allow independent optimization. See: https://github.com/pokt-network/poktroll/pull/1764#pullrequestreview-3232115767
func NewDefaultHTTPClientWithDebugMetrics ¶
func NewDefaultHTTPClientWithDebugMetrics() *HTTPClientWithDebugMetrics
NewDefaultHTTPClientWithDebugMetrics creates a new HTTP client with: - Transport settings configured for high-concurrency usage - Built in request debugging capabilities and metrics tracking TODO_TECHDEBT(@adshmh): Make HTTP client settings configurable
func (*HTTPClientWithDebugMetrics) Do ¶
func (h *HTTPClientWithDebugMetrics) Do( ctx context.Context, logger polylog.Logger, req *http.Request, ) (*http.Response, error)
TODO_TECHDEBT(@adshmh): Switch to buffered reading of the HTTP response.
Do executes an HTTP request using the provided context and logger. It acquires a concurrency slot before proceeding and sets up a debugging context to track detailed metrics of the request lifecycle. In case of an error, it logs the metrics for debugging purposes.
Returns: - *http.Response: the HTTP response received from the server. - error: an error if the request fails, or nil if successful.