-
Notifications
You must be signed in to change notification settings - Fork 556
Update migration guide for async transport #4732
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## potel-base #4732 +/- ##
==============================================
- Coverage 84.61% 84.61% -0.01%
==============================================
Files 158 158
Lines 16162 16162
Branches 2575 2575
==============================================
- Hits 13676 13675 -1
Misses 1693 1693
- Partials 793 794 +1 |
MIGRATION_GUIDE.md
Outdated
- Added a new experimental async transport using the [httpcore](https://pypi.org/project/httpcore/) library. Requires the [httpcore[asyncio]](https://www.encode.io/httpcore/async/) extension. The async transport makes Sentry network I/O non-blocking in async programs. The async transport can only be used when an event loop is running, and additionally requires the [asyncio](https://docs.sentry.io/platforms/python/integrations/asyncio/) integration. Can be enabled by passing ``transport_async=true`` in the experiments dict in ``sentry.init()``. | ||
- Added an asynchronous context manager for spans. This can be used to remove unnessecary nesting for span creation in async programs. | ||
- Added `flush_async()` as a top level API. This has to be used when flushing the async transport. `flush_async` is a coroutine and can be awaited if blocking behaviour is desired. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential bug: The migration guide documents a new flush_async()
function and transport_async
option, but they are not implemented, causing an AttributeError
when called.
-
Description: The migration guide introduces documentation for new asynchronous transport functionality, including a top-level
flush_async()
function, anAsyncHttpTransport
class, and atransport_async
configuration option. However, none of these features are implemented in the codebase. Users following the guide and attempting to callsentry_sdk.flush_async()
will encounter anAttributeError
, causing their application to crash. This discrepancy between documentation and the actual API guarantees a runtime failure for users trying to adopt the documented async features. -
Suggested fix: Remove the section from the migration guide that describes the
flush_async()
function, thetransport_async
configuration option, and theAsyncHttpTransport
class, as these features are not implemented in the current codebase. Alternatively, implement the documented functionality.
severity: 0.82, confidence: 0.98
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seer seems to have a point here unless I'm grepping incorrectly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created the migration branch before adding this function to the API, I can merge potel base back in then flush_async should be here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be here now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding! Left some formatting suggestions and a question regarding the seer comment
MIGRATION_GUIDE.md
Outdated
- Added a new experimental async transport using the [httpcore](https://pypi.org/project/httpcore/) library. Requires the [httpcore[asyncio]](https://www.encode.io/httpcore/async/) extension. The async transport makes Sentry network I/O non-blocking in async programs. The async transport can only be used when an event loop is running, and additionally requires the [asyncio](https://docs.sentry.io/platforms/python/integrations/asyncio/) integration. Can be enabled by passing ``transport_async=true`` in the experiments dict in ``sentry.init()``. | ||
- Added an asynchronous context manager for spans. This can be used to remove unnessecary nesting for span creation in async programs. | ||
- Added `flush_async()` as a top level API. This has to be used when flushing the async transport. `flush_async` is a coroutine and can be awaited if blocking behaviour is desired. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seer seems to have a point here unless I'm grepping incorrectly
MIGRATION_GUIDE.md
Outdated
@@ -8,7 +8,9 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh | |||
|
|||
- Added `add_attachment()` as a top level API, so you can do now: `sentry_sdk.add_attachment(...)` (up until now it was only available on the `Scope`) | |||
- Added a new SDK option `exclude_span_origins`. Spans with an `origin` from `exclude_span_origins` won't be created. This can be used for example in dual OpenTelemetry/Sentry setups to filter out spans from specific Sentry instrumentations. Note that using `exclude_span_origins` might potentially lead to surprising results: if, for example, a root span is excluded based on `origin`, all of its children will become root spans, unless they were started with `only_as_child_span=True`. | |||
|
|||
- Added a new experimental async transport using the [httpcore](https://pypi.org/project/httpcore/) library. Requires the [httpcore[asyncio]](https://www.encode.io/httpcore/async/) extension. The async transport makes Sentry network I/O non-blocking in async programs. The async transport can only be used when an event loop is running, and additionally requires the [asyncio](https://docs.sentry.io/platforms/python/integrations/asyncio/) integration. Can be enabled by passing ``transport_async=true`` in the experiments dict in ``sentry.init()``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth having a code snippet?
- Added a new experimental async transport using the [httpcore](https://pypi.org/project/httpcore/) library. Requires the [httpcore[asyncio]](https://www.encode.io/httpcore/async/) extension. The async transport makes Sentry network I/O non-blocking in async programs. The async transport can only be used when an event loop is running, and additionally requires the [asyncio](https://docs.sentry.io/platforms/python/integrations/asyncio/) integration. Can be enabled by passing ``transport_async=true`` in the experiments dict in ``sentry.init()``. | |
- Added a new experimental async transport using the [httpcore](https://pypi.org/project/httpcore/) library. Requires the [httpcore[asyncio]](https://www.encode.io/httpcore/async/) extension. The async transport makes Sentry network I/O non-blocking in async programs. The async transport can only be used when an event loop is running. Try it out by initializing Sentry with: | |
```python | |
import sentry_sdk | |
from sentry_sdk.integrations.asyncio import AsyncioIntegration | |
sentry_sdk.init( | |
_experiments={ | |
"transport_async": True, | |
}, | |
integrations=[ | |
sentry_sdk.AsyncIO(), | |
] | |
) | |
```. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added, thanks for the suggestion!
Co-authored-by: Ivana Kellyer <[email protected]>
…details Expanded the migration guide with details on the new experimental async transport feature and provided usage examples.
Corrected a typo in the migration guide regarding the asynchronous context manager for spans.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
Co-authored-by: Ivana Kellyer <[email protected]>
Update the migration guide for 3.0 to include information on the async transport and context manager