Skip to content

Commit fae3588

Browse files
authored
Merge pull request #175 from deploymenttheory/dev
Adjust concurrency logic and metrics in the concurrency package and a…
2 parents bdb2091 + 146dabe commit fae3588

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

concurrency/metrics.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ func (ch *ConcurrencyHandler) MonitorServerResponseCodes(resp *http.Response) in
148148
ch.Metrics.Lock.Lock()
149149
defer ch.Metrics.Lock.Unlock()
150150

151-
// Reset error rates on successful response
152151
if statusCode >= 200 && statusCode < 300 {
153152
ch.Metrics.TotalRateLimitErrors = 0
154153
ch.Metrics.TotalRetries = 0
@@ -164,6 +163,13 @@ func (ch *ConcurrencyHandler) MonitorServerResponseCodes(resp *http.Response) in
164163

165164
ch.Metrics.ResponseCodeMetrics.ErrorRate = errorRate
166165

166+
ch.logger.Debug("Server Response Code Monitoring",
167+
zap.Int("StatusCode", statusCode),
168+
zap.Float64("TotalRequests", totalRequests),
169+
zap.Float64("TotalErrors", totalErrors),
170+
zap.Float64("ErrorRate", errorRate),
171+
)
172+
167173
if errorRate > ErrorRateThreshold {
168174
return -1
169175
} else if errorRate <= ErrorRateThreshold && len(ch.sem) < MaxConcurrency {

0 commit comments

Comments
 (0)