Skip to content

Commit e1951af

Browse files
committed
chore: rebase
1 parent 71f31e3 commit e1951af

File tree

1 file changed

+12
-8
lines changed
  • src/sentry/hybridcloud/apigateway

1 file changed

+12
-8
lines changed

src/sentry/hybridcloud/apigateway/proxy.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from django.http.response import HttpResponseBase
1515
from requests import Response as ExternalResponse
1616
from requests import request as external_request
17-
from requests.exceptions import Timeout
17+
from requests.exceptions import ConnectionError, Timeout
1818

1919
from sentry import options
2020
from sentry.api.exceptions import RequestTimeout
@@ -193,18 +193,22 @@ def proxy_cell_request(request: HttpRequest, cell: Cell, url_name: str) -> HttpR
193193
)
194194
except Timeout:
195195
metrics.incr("apigateway.proxy.request_timeout", tags=metric_tags)
196-
try:
197-
if circuit_breaker is not None:
198-
circuit_breaker.record_error()
199-
except Exception:
200-
logger.exception("Failed to record circuitbreaker failure")
196+
if circuit_breaker is not None:
197+
circuit_breaker.record_error()
201198

202199
# remote silo timeout. Use DRF timeout instead
203200
raise RequestTimeout()
201+
except ConnectionError:
202+
metrics.incr("apigateway.proxy.connection_error", tags=metric_tags)
203+
if circuit_breaker is not None:
204+
circuit_breaker.record_error()
205+
206+
raise
204207

205-
if resp.status_code >= 500 and circuit_breaker is not None:
208+
if resp.status_code >= 502:
206209
metrics.incr("apigateway.proxy.request_failed", tags=metric_tags)
207-
circuit_breaker.record_error()
210+
if circuit_breaker is not None:
211+
circuit_breaker.record_error()
208212

209213
new_headers = clean_outbound_headers(resp.headers)
210214
resp.headers.clear()

0 commit comments

Comments
 (0)