diff --git a/proxy/metrics.go b/proxy/metrics.go index a8a501f..6bc4460 100644 --- a/proxy/metrics.go +++ b/proxy/metrics.go @@ -17,6 +17,7 @@ var ( confighubErrorsCounter = metrics.NewCounter("orderflow_proxy_confighub_errors") shareQueueInternalErrors = metrics.NewCounter("orderflow_proxy_share_queue_internal_errors") + apiLocalRateLimits = metrics.NewCounter("orderflow_proxy_api_local_rate_limits") ) const ( @@ -39,6 +40,10 @@ func incAPIDuplicateRequestsByPeer(peer string) { metrics.GetOrCreateCounter(l).Inc() } +func incAPILocalRateLimits() { + apiLocalRateLimits.Inc() +} + func incShareQueueTotalRequests(peer string) { l := fmt.Sprintf(shareQueuePeerTotalRequestsLabel, peer) metrics.GetOrCreateCounter(l).Inc() diff --git a/proxy/receiver_api.go b/proxy/receiver_api.go index 0645c81..fc46a2a 100644 --- a/proxy/receiver_api.go +++ b/proxy/receiver_api.go @@ -319,6 +319,7 @@ func (prx *ReceiverProxy) HandleParsedRequest(ctx context.Context, parsedRequest if !parsedRequest.publicEndpoint { err := prx.localAPIRateLimiter.Wait(ctx) if err != nil { + incAPILocalRateLimits() return errors.Join(errRateLimiting, err) } }