-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
chore(sentryapp): new SentryAppWebhookRequestsEndpoint
control endpoint
#81676
base: master
Are you sure you want to change the base?
Conversation
❌ 1 Tests Failed:
View the top 1 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
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 think there is some opportunity to condense code here
publish_status = { | ||
"GET": ApiPublishStatus.UNKNOWN, | ||
} | ||
permission_classes = (SentryAppStatsPermission,) |
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 this be SentryAppPermission
?
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.
SentryAppStatsPermission
is the one to use for this endpoint, since we only want the integrator org to be able to get the requests/stats.
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.
there seems to only be a GET for this endpoint, so only the GET scopes would apply. the PARANOID_GET scopes from SentryAppPermission applies to anyone with member and above permissions which also seems appropriate
3c9862c
to
a117f74
Compare
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
Bundle ReportChanges will decrease total bundle size by 3.8kB (-0.01%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: app-webpack-bundle-array-pushAssets Changed:
Files in
|
SentryAppRequestsEndpointV2
control endpointSentryAppWebhookRequestsEndpoint
control endpoint
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.
looks good, good job!
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.
UHHH I FORGOT TO CLICK SUBMIT. I did this on monday so it may be out of date
src/sentry/sentry_apps/api/serializers/sentry_app_webhook_request.py
Outdated
Show resolved
Hide resolved
tests/sentry/sentry_apps/api/endpoints/test_sentry_app_webhook_requests.py
Show resolved
Hide resolved
tests/sentry/sentry_apps/api/endpoints/test_sentry_app_webhook_requests.py
Show resolved
Hide resolved
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 started reviewing but then I realized there are multiple open questions that I also have too. Can you address them and ping the channel again?
src/sentry/sentry_apps/api/endpoints/sentry_app_webhook_requests.py
Outdated
Show resolved
Hide resolved
src/sentry/sentry_apps/api/endpoints/sentry_app_webhook_requests.py
Outdated
Show resolved
Hide resolved
src/sentry/sentry_apps/api/serializers/sentry_app_webhook_request.py
Outdated
Show resolved
Hide resolved
tests/sentry/sentry_apps/api/endpoints/test_sentry_app_webhook_requests.py
Show resolved
Hide resolved
src/sentry/sentry_apps/api/serializers/sentry_app_webhook_request.py
Outdated
Show resolved
Hide resolved
This pull request has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you add the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
d012277
to
174e0c3
Compare
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.
overall lgtm, just some Qs. I will rerequest
src/sentry/sentry_apps/api/serializers/sentry_app_webhook_request.py
Outdated
Show resolved
Hide resolved
@@ -100,18 +113,26 @@ def _get_all_from_buffer( | |||
else: | |||
return self.client.lrange(buffer_key, 0, BUFFER_SIZE - 1) | |||
|
|||
def _get_requests(self, event: str | None = None, error: bool = False) -> list[dict[str, Any]]: | |||
def _get_requests( | |||
self, event: str | list[str] | None = None, error: bool = False |
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.
How hard would it be to make event only be a list of strings so we don't have to the check to see if it's one or multiple ? Also idk if there was a discussion or anything about this already
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.
mmm I think we can get rid of the str |
once we get rid of the old endpoint, I'd rather not modify the old endpoint rn
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.
ohh gotchas, rip
filter: SentryAppRequestFilterArgs, | ||
datetime_org_filter: DatetimeOrganizationFilterArgs, |
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.
Curious Q: why are the datetime and event filters applied in different places ? (it's not a big deal but was just wondering if there was some context behind it ?)
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.
event filtering is done within buffer.get_requests
inside of get_buffer_requests_for_region
, while the datetime and org filtering is done to the results of that call
for req in buffer.get_requests(event=event, errors_only=errors_only) |
We need a new control endpoint in order to fetch sentry app requests from all regions.
Note:
Since installation requests are stored in control, we also have to fetch requests from the control buffer. We specifically query the region buffers for non-installation event requests to avoid duplicate requests (in case a region shares the same buffer as control).