Skip to content

Commit bb943ec

Browse files
committed
local rate limit metric
1 parent 96285e6 commit bb943ec

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

proxy/metrics.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var (
1717
confighubErrorsCounter = metrics.NewCounter("orderflow_proxy_confighub_errors")
1818

1919
shareQueueInternalErrors = metrics.NewCounter("orderflow_proxy_share_queue_internal_errors")
20+
apiLocalRateLimits = metrics.NewCounter("orderflow_proxy_api_local_rate_limits")
2021
)
2122

2223
const (
@@ -39,6 +40,10 @@ func incAPIDuplicateRequestsByPeer(peer string) {
3940
metrics.GetOrCreateCounter(l).Inc()
4041
}
4142

43+
func incAPILocalRateLimits() {
44+
apiLocalRateLimits.Inc()
45+
}
46+
4247
func incShareQueueTotalRequests(peer string) {
4348
l := fmt.Sprintf(shareQueuePeerTotalRequestsLabel, peer)
4449
metrics.GetOrCreateCounter(l).Inc()

proxy/receiver_api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ func (prx *ReceiverProxy) HandleParsedRequest(ctx context.Context, parsedRequest
319319
if !parsedRequest.publicEndpoint {
320320
err := prx.localAPIRateLimiter.Wait(ctx)
321321
if err != nil {
322+
incAPILocalRateLimits()
322323
return errors.Join(errRateLimiting, err)
323324
}
324325
}

0 commit comments

Comments
 (0)