Skip to content

Commit 1d54732

Browse files
committed
Add monitoring for response time variability, server response codes, and rate limit headers in executeRequest function
1 parent 3668635 commit 1d54732

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

httpclient/request.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,27 @@ func (c *Client) executeRequest(method, endpoint string, body, out interface{})
330330
// Log outgoing cookies
331331
log.LogCookies("outgoing", req, method, endpoint)
332332

333+
// Measure the time taken to execute the request and receive the response
334+
startTime := time.Now()
335+
333336
// Execute the HTTP request
334337
resp, err := c.do(req, log, method, endpoint)
335338
if err != nil {
336339
return nil, err
337340
}
338341

342+
// Calculate the duration between sending the request and receiving the response
343+
duration := time.Since(startTime)
344+
345+
// Monitor response time variability
346+
c.ConcurrencyHandler.MonitorResponseTimeVariability(duration)
347+
348+
// Monitor server response codes
349+
c.ConcurrencyHandler.MonitorServerResponseCodes(resp)
350+
351+
// Monitor rate limit headers
352+
c.ConcurrencyHandler.MonitorRateLimitHeaders(resp)
353+
339354
// Log outgoing cookies
340355
log.LogCookies("incoming", req, method, endpoint)
341356

0 commit comments

Comments
 (0)