Socket
Use this integration to create spans for DNS resolves and socket connection creations.
Install `sentry-sdk`` from PyPI.
Copied
pip install --upgrade 'sentry-sdk'
Add SocketIntegration()
to your integrations
list:
Copied
import sentry_sdk
from sentry_sdk.integrations.socket import SocketIntegration
sentry_sdk.init(
dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
enable_tracing=True,
integrations=[
SocketIntegration(),
],
)
Copied
import socket
def main():
sentry_init(...) # same as above
with sentry_sdk.start_transaction(name="testing_sentry"):
timeout = 10
socket.getaddrinfo("sentry.io", 443)
socket.create_connection(("sentry.io", 443), timeout, None)
main()
This example will create a transaction called testing_sentry
in the Performance section of sentry.io, and create spans for the socket commands.
It takes a couple of moments for the data to appear in sentry.io.
- Python: 3.6+
The versions above apply for Sentry Python SDK version 2.0+
, which drops support for some legacy Python and framework versions. If you're looking to use Sentry with older Python or framework versions, consider using an SDK version from the 1.x
major line of releases.
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
- Package:
- pypi:sentry-sdk
- Version:
- 2.0.0
- Repository:
- https://github.com/getsentry/sentry-python
- API Documentation:
- https://getsentry.github.io/sentry-python/