-
Notifications
You must be signed in to change notification settings - Fork 571
docs(sdk): Enhance README with improved clarity and developer-friendly examples #3667
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
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fef896c
docs(sdk): Enhance README with improved clarity and developer-friendl…
UTSAVS26 0f3b498
Resolve
UTSAVS26 d538124
Merge branch 'master' into UTSAVS26-patch-1
UTSAVS26 72c0d43
Update README.md
UTSAVS26 bf25741
Update README.md
UTSAVS26 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,111 +2,127 @@ | |
| <img src="https://sentry-brand.storage.googleapis.com/github-banners/github-sdk-python.png" alt="Sentry for Python"> | ||
| </a> | ||
|
|
||
| _Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us, [<kbd>**check out our open positions**</kbd>](https://sentry.io/careers/)_. | ||
| Bad software is everywhere, and developers often deal with bugs that crash systems at the worst possible moments. Enter **Sentry**: our mission is to help developers write better software faster, so you can focus on building. | ||
|
|
||
| # Official Sentry SDK for Python | ||
|
|
||
| [](https://github.com/getsentry/sentry-python/actions/workflows/ci.yml) | ||
| [](https://pypi.python.org/pypi/sentry-sdk) | ||
| [](https://discord.gg/cWnMQeA) | ||
|
|
||
| This is the official Python SDK for [Sentry](http://sentry.io/) | ||
| Welcome to the official Python SDK for **[Sentry](http://sentry.io/)**! If you care about tracking down every error and performance bottleneck in your app, you're in the right place. | ||
UTSAVS26 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Getting Started | ||
|
|
||
| ### Install | ||
| ### Installation | ||
|
|
||
| Getting Sentry into your project is straightforward. Just run this command in your terminal: | ||
|
|
||
| ```bash | ||
| pip install --upgrade sentry-sdk | ||
| ``` | ||
|
|
||
| ### Configuration | ||
| ### Basic Configuration | ||
|
|
||
| Here’s a quick configuration example to get Sentry up and running: | ||
|
|
||
| ```python | ||
| import sentry_sdk | ||
|
|
||
| sentry_sdk.init( | ||
| "https://[email protected]/1", | ||
| "https://[email protected]/1", # Your DSN here | ||
|
|
||
| # Set traces_sample_rate to 1.0 to capture 100% | ||
| # of transactions for performance monitoring. | ||
| traces_sample_rate=1.0, | ||
| traces_sample_rate=1.0, # Adjust this based on your performance needs | ||
UTSAVS26 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) | ||
| ``` | ||
|
|
||
| ### Usage | ||
| With this configuration, Sentry will monitor for exceptions and performance issues in the background while you continue coding. Adjust the `traces_sample_rate` to fine-tune performance monitoring. | ||
UTSAVS26 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Quick Usage Example | ||
|
|
||
| To generate some events that will show up in Sentry, you can log messages or capture errors: | ||
|
|
||
| ```python | ||
| from sentry_sdk import capture_message | ||
| capture_message("Hello World") # Will create an event in Sentry. | ||
| capture_message("Hello Sentry!") # You'll see this in your Sentry dashboard. | ||
|
|
||
| raise ValueError() # Will also create an event in Sentry. | ||
| raise ValueError("Oops, something went wrong!") # This will create an error event in Sentry. | ||
| ``` | ||
|
|
||
| - To learn more about how to use the SDK [refer to our docs](https://docs.sentry.io/platforms/python/). | ||
| - Are you coming from `raven-python`? [Use this migration guide](https://docs.sentry.io/platforms/python/migration/). | ||
| - To learn about internals use the [API Reference](https://getsentry.github.io/sentry-python/). | ||
| #### Explore the Docs | ||
|
|
||
| For more details on advanced usage, integrations, and customization, check out the full documentation: | ||
|
|
||
| - [Official SDK Docs](https://docs.sentry.io/platforms/python/) | ||
| - [API Reference](https://getsentry.github.io/sentry-python/) | ||
|
|
||
| ### Migrating from `raven-python`? | ||
| If you’re still using `raven-python`, migrating to the new Sentry SDK is smooth. [Check out this guide](https://docs.sentry.io/platforms/python/migration/) for details. | ||
UTSAVS26 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Integrations | ||
|
|
||
| (If you want to create a new integration, have a look at the [Adding a new integration checklist](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md#adding-a-new-integration).) | ||
| Sentry integrates with several popular Python libraries and frameworks, including: | ||
UTSAVS26 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - [Django](https://docs.sentry.io/platforms/python/integrations/django/) – Full support for error and performance tracking. | ||
| - [Flask](https://docs.sentry.io/platforms/python/integrations/flask/) – Flask-specific error handling. | ||
| - [FastAPI](https://docs.sentry.io/platforms/python/integrations/fastapi/) – FastAPI support. | ||
| - [Celery](https://docs.sentry.io/platforms/python/integrations/celery/) – Monitoring distributed tasks. | ||
| - [AWS Lambda](https://docs.sentry.io/platforms/python/integrations/aws-lambda/) – Support for serverless applications. | ||
UTSAVS26 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Want more? [Check out the full list of integrations](https://docs.sentry.io/platforms/python/integrations/). | ||
|
|
||
| See [the documentation](https://docs.sentry.io/platforms/python/integrations/) for an up-to-date list of libraries and frameworks we support. Here are some examples: | ||
| ### Rolling Your Own Integration? | ||
|
|
||
| - [Django](https://docs.sentry.io/platforms/python/integrations/django/) | ||
| - [Flask](https://docs.sentry.io/platforms/python/integrations/flask/) | ||
| - [FastAPI](https://docs.sentry.io/platforms/python/integrations/fastapi/) | ||
| - [AIOHTTP](https://docs.sentry.io/platforms/python/integrations/aiohttp/) | ||
| - [SQLAlchemy](https://docs.sentry.io/platforms/python/integrations/sqlalchemy/) | ||
| - [asyncpg](https://docs.sentry.io/platforms/python/integrations/asyncpg/) | ||
| - [Redis](https://docs.sentry.io/platforms/python/integrations/redis/) | ||
| - [Celery](https://docs.sentry.io/platforms/python/integrations/celery/) | ||
| - [Apache Airflow](https://docs.sentry.io/platforms/python/integrations/airflow/) | ||
| - [Apache Spark](https://docs.sentry.io/platforms/python/integrations/pyspark/) | ||
| - [asyncio](https://docs.sentry.io/platforms/python/integrations/asyncio/) | ||
| - [Graphene](https://docs.sentry.io/platforms/python/integrations/graphene/) | ||
| - [Logging](https://docs.sentry.io/platforms/python/integrations/logging/) | ||
| - [Loguru](https://docs.sentry.io/platforms/python/integrations/loguru/) | ||
| - [HTTPX](https://docs.sentry.io/platforms/python/integrations/httpx/) | ||
| - [AWS Lambda](https://docs.sentry.io/platforms/python/integrations/aws-lambda/) | ||
| - [Google Cloud Functions](https://docs.sentry.io/platforms/python/integrations/gcp-functions/) | ||
| If you want to create a new integration or improve an existing one, we’d welcome your contributions! Please read our [contributing guide](https://github.com/getsentry/sentry-python/blob/master/CONTRIBUTING.md) before starting. | ||
|
|
||
| ## Migrating Between Versions? | ||
|
|
||
| ## Migrating | ||
| ### From `1.x` to `2.x` | ||
|
|
||
| ### Migrating From `1.x` to `2.x` | ||
| If you're using the older `1.x` version of the SDK, now's the time to upgrade to `2.x`. It includes significant upgrades and new features. Check our [migration guide](https://docs.sentry.io/platforms/python/migration/1.x-to-2.x) for assistance. | ||
|
|
||
| If you're on SDK version 1.x, we highly recommend updating to the 2.x major. To make the process easier we've prepared a [migration guide](https://docs.sentry.io/platforms/python/migration/1.x-to-2.x) with the most common changes as well as a [detailed changelog](MIGRATION_GUIDE.md). | ||
| ### From `raven-python` | ||
|
|
||
| ### Migrating From `raven-python` | ||
| Using the legacy `raven-python` client? It's now in maintenance mode, and we recommend migrating to the new SDK for an improved experience. Get all the details in our [migration guide](https://docs.sentry.io/platforms/python/migration/raven-to-sentry-sdk/). | ||
|
|
||
| The old `raven-python` client has entered maintenance mode and was moved [here](https://github.com/getsentry/raven-python). | ||
| ## Want to Contribute? | ||
|
|
||
| If you're using `raven-python`, we recommend you to migrate to this new SDK. You can find the benefits of migrating and how to do it in our [migration guide](https://docs.sentry.io/platforms/python/migration/raven-to-sentry-sdk/). | ||
| We’d love your help in improving the Sentry SDK! Whether it’s fixing bugs, adding features, or enhancing documentation, every contribution is valuable. | ||
|
|
||
| ## Contributing to the SDK | ||
| For details on how to contribute, please check out [CONTRIBUTING.md](CONTRIBUTING.md) and explore the [open issues](https://github.com/getsentry/sentry-python/issues). | ||
|
|
||
| Please refer to [CONTRIBUTING.md](CONTRIBUTING.md). | ||
| ## Need Help? | ||
|
|
||
| ## Getting Help/Support | ||
| If you encounter issues, don’t hesitate to reach out to our community for support: | ||
UTSAVS26 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| If you need help setting up or configuring the Python SDK (or anything else in the Sentry universe) please head over to the [Sentry Community on Discord](https://discord.com/invite/Ww9hbqr). There is a ton of great people in our Discord community ready to help you! | ||
| - **[Sentry Discord Community](https://discord.com/invite/Ww9hbqr)** – A helpful community is ready to assist. | ||
| - **[Stack Overflow](http://stackoverflow.com/questions/tagged/sentry)** – A great place for asking questions. | ||
| - **[Sentry Forum](https://forum.sentry.io/c/sdks)** – Share ideas and get advice. | ||
UTSAVS26 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Resources | ||
|
|
||
| - [](https://docs.sentry.io/quickstart/) | ||
| - [](https://forum.sentry.io/c/sdks) | ||
| - [](https://discord.gg/Ww9hbqr) | ||
| - [](http://stackoverflow.com/questions/tagged/sentry) | ||
| - [](https://twitter.com/intent/follow?screen_name=getsentry) | ||
| Here are additional resources to help you make the most of Sentry: | ||
|
|
||
| - [](https://docs.sentry.io/quickstart/) – Official documentation to get started. | ||
| - [](https://forum.sentry.io/c/sdks) – Forums for in-depth discussions. | ||
| - [](http://stackoverflow.com/questions/tagged/sentry) – Ask questions here. | ||
| - [](https://discord.gg/Ww9hbqr) – Join our Discord community. | ||
| - [](https://twitter.com/intent/follow?screen_name=getsentry) – Follow us on Twitter for updates. | ||
UTSAVS26 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## License | ||
|
|
||
| Licensed under the MIT license, see [`LICENSE`](LICENSE) | ||
| The SDK is open-source and available under the MIT license. Check out the [LICENSE](LICENSE) file for more information. | ||
|
|
||
| --- | ||
|
|
||
| ### Thanks to all the people who contributed! | ||
| Thanks to all the contributors who have made the Sentry Python SDK great! | ||
UTSAVS26 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| <a href="https://github.com/getsentry/sentry-python/graphs/contributors"> | ||
| <img src="https://contributors-img.web.app/image?repo=getsentry/sentry-python" /> | ||
| </a> | ||
|
|
||
| --- | ||
|
|
||
| Keep writing better code and let Sentry handle the errors. | ||
UTSAVS26 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.