Skip to content

Commit 0622f52

Browse files
feat(python): Add new config option (#9332)
--------- Co-authored-by: vivianyentran <[email protected]>
1 parent f3810ce commit 0622f52

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/platforms/python/configuration/options.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,23 @@ Controls how many seconds to wait before shutting down. Sentry SDKs send events
262262

263263
</ConfigKey>
264264

265+
<ConfigKey name="socket-options">
266+
267+
An optional list of socket options to use. If provided, these will override the default `urllib3` [socket options](https://urllib3.readthedocs.io/en/stable/reference/urllib3.connection.html#urllib3.connection.HTTPConnection). This is useful for enabling TCP keepalive in environments where you encounter frequent connection resets:
268+
269+
```python
270+
import socket
271+
from urllib3.connection import HTTPConnection
272+
273+
sentry_sdk.init(
274+
socket_options=HTTPConnection.default_socket_options + [
275+
(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1),
276+
],
277+
)
278+
```
279+
280+
</ConfigKey>
281+
265282
## Tracing Options
266283

267284
<ConfigKey name="enable-tracing">

0 commit comments

Comments
 (0)