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
ref(api): Remove store endpoint #2656
ref(api): Remove store endpoint #2656
Conversation
I will make a separate PR for this
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.
https://github.com/getsentry/sentry-python/blob/sentry-sdk-2.0/sentry_sdk/scope.py#L613-L629
This can also be cleaned up.
- Remove the
has_tracing_enabled
check - We do not need to set the
replay
context anymore; this was a workaround applying to the/store
endpoint only
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.
LGTM in general. Left a couple of comments.
Also, there's a migration guide on the 2.0 branch, please update it and add to this PR.
sentry_sdk/transport.py
Outdated
@@ -1,12 +1,16 @@ | |||
from __future__ import print_function |
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.
We don't need this on the 2.0 branch because there's no Python 2 support anymore
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.
Good catch – I think Git somehow put this line in when I was splitting the Transport
ABC
stuff into a separate PR
@@ -183,27 +179,23 @@ def inner( | |||
response["Payload"] = json.loads(response["Payload"].read().decode("utf-8")) | |||
del response["ResponseMetadata"] | |||
|
|||
events = [] | |||
envelopes = [] | |||
envelope_item = [] |
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.
Why not keep calling this envelopes
? That's the usual convention in our tests. Or maybe at least envelope_items
, since it's a collection of items rather than one item?
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 made the change because we are actually capturing envelope Item
s here, not Envelope
s. The previous naming confused me when I was looking at the tests, because I thought these were Envelope
objects, and I thought I would have to somehow manually extract the events (i.e. Item
s) from them. The name envelope_items
makes it clear that we are dealing with Item
objects, not Envelope
objects, here.
I believe the that in the "usual convention" you are referring to, we are capturing the envelopes using the capture_envelopes
fixture, which returns a list[Envelope]
. Therefore, while the envelopes
name is the appropriate choice in those cases, the distinct envelope_items
name here is warranted because here we have a list[Item]
, which we need to handle differently.
You are right though, we should be calling this variable envelope_items
rather than envelope_item
. I will make this change.
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.
Then let's go with envelope_items
👍🏻
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.
As you walked me through the changes already, this looks good to me!
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.
Please see one comment about the migration guide, otherwise LGTM
* remove deprecated client options * remove .install() * remove new_span
Summary
This change removes all usages of the deprecated
store
endpoint from the Python SDK. From now on, events that were previously sent to thestore
endpoint will now be sent as envelopes to theenvelope
endpoint.Breaking API changes
sentry_sdk.transport.Transport
is now an abstract base class, and therefore, it cannot be instantiated directly. Subclasses must implement thecapture_envelope
method.sentry_sdk.utils.Auth.store_api_url
has been removed.sentry_sdk.utils.Auth.get_api_url
's now accepts asentry_sdk.consts.EndpointType
enum instead of a string as its only parameter. Supplying this parameter is currently unnecessary, since the parameter's default value is the only possiblesentry_sdk.consts.EndpointType
value.Backwards-compatible API changes
sentry_sdk.transport.Transport.capture_event
has been deprecated. Please usesentry_sdk.transport.Transport.capture_envelope
, instead.sentry_sdk.init
'stransport
keyword argument has been deprecated. If you wish to provide a custom transport, please pass asentry_sdk.transport.Transport
instance or a subclass.Other changes
sentry_sdk.transport.HttpTransport._send_event
has been removed, and uses of this method have been removed from the codebase, including from tests.Fixes GH-1957
General Notes
Thank you for contributing to
sentry-python
!Please add tests to validate your changes, and lint your code using
tox -e linters
.Running the test suite on your PR might require maintainer approval. Some tests (AWS Lambda) additionally require a maintainer to add a special label to run and will fail if the label is not present.
For maintainers
Sensitive test suites require maintainer review to ensure that tests do not compromise our secrets. This review must be repeated after any code revisions.
Before running sensitive test suites, please carefully check the PR. Then, apply the
Trigger: tests using secrets
label. The label will be removed after any code changes to enforce our policy requiring maintainers to review all code revisions before running sensitive tests.