You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: concurrency/handler.go
+15-8Lines changed: 15 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -25,14 +25,11 @@ type ConcurrencyHandler struct {
25
25
Metrics*ConcurrencyMetrics
26
26
}
27
27
28
-
// ConcurrencyMetrics captures various metrics related to managing concurrency for the client's interactions with the API.// ConcurrencyMetrics captures various metrics related to managing concurrency for the client's interactions with the API.
28
+
// ConcurrencyMetrics captures various metrics related to managing concurrency for the client's interactions with the API.
29
29
typeConcurrencyMetricsstruct {
30
30
TotalRequestsint64// Total number of requests made
31
31
TotalRetriesint64// Total number of retry attempts
32
32
TotalRateLimitErrorsint64// Total number of rate limit errors encountered
33
-
TotalResponseTime time.Duration// Total response time for all requests
34
-
AverageResponseTime time.Duration// Average response time across all requests
35
-
ErrorRatefloat64// Error rate calculated as (TotalRateLimitErrors + 5xxErrors) / TotalRequests
36
33
TokenWaitTime time.Duration// Total time spent waiting for tokens
37
34
TTFBstruct { // Metrics related to Time to First Byte (TTFB)
38
35
Total time.Duration// Total Time to First Byte (TTFB) for all requests
@@ -42,11 +39,21 @@ type ConcurrencyMetrics struct {
42
39
Throughputstruct { // Metrics related to network throughput
43
40
Totalfloat64// Total network throughput for all requests
44
41
Countint64// Count of requests used for calculating throughput
45
-
Lock sync.Mutex// Lock for throughput metrics
42
+
Lock sync.Mutex// Lock for throughput metrics/
46
43
}
47
-
Variancefloat64// Variance of response times
48
-
ResponseCountint64// Count of responses used for calculating response time variability
49
-
Lock sync.Mutex// Lock for overall metrics fields
44
+
ResponseTimeVariabilitystruct { // Metrics related to response time variability
45
+
Total time.Duration// Total response time for all requests
46
+
Average time.Duration// Average response time across all requests
47
+
Variancefloat64// Variance of response times
48
+
Countint64// Count of responses used for calculating response time variability
49
+
Lock sync.Mutex// Lock for response time variability metrics
50
+
StdDevThresholdfloat64// Maximum acceptable standard deviation for adjusting concurrency
51
+
}
52
+
ResponseCodeMetricsstruct {
53
+
ErrorRatefloat64// Error rate calculated as (TotalRateLimitErrors + 5xxErrors) / TotalRequests
54
+
Lock sync.Mutex// Lock for response code metrics
55
+
}
56
+
Lock sync.Mutex// Lock for overall metrics fields
50
57
}
51
58
52
59
// NewConcurrencyHandler initializes a new ConcurrencyHandler with the given
0 commit comments