Skip to content

Mitigate CPU spikes when sending lots of events with lots of data #2449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 17, 2023
7 changes: 4 additions & 3 deletions sentry_sdk/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ def record_loss(reason):
str(self._auth.get_api_url(endpoint_type)),
body=body,
headers=headers,
preload_content=False,
)
response.release_conn()
except Exception:
self.on_dropped_event("network")
record_loss("network_error")
Expand All @@ -263,9 +265,8 @@ def record_loss(reason):

elif response.status >= 300 or response.status < 200:
logger.error(
"Unexpected status code: %s (body: %s)",
"Unexpected status code: %s",
response.status,
response.data,
)
self.on_dropped_event("status_{}".format(response.status))
record_loss("network_error")
Expand Down Expand Up @@ -439,7 +440,7 @@ def _send_envelope(
def _get_pool_options(self, ca_certs):
# type: (Optional[Any]) -> Dict[str, Any]
return {
"num_pools": 2,
"num_pools": 10,
"cert_reqs": "CERT_REQUIRED",
"ca_certs": ca_certs or certifi.where(),
}
Expand Down