-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(sentry apps): add urls to issue.created webhook #93780
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
base: master
Are you sure you want to change the base?
Conversation
) -> WebhookGroupResponse: | ||
|
||
webhook_payload = WebhookGroupResponse( | ||
url=absolute_uri(f"/api/0/organizations/{group.organization.slug}/issues/{group.id}/"), |
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 would be a bit cleaner add this as another method on the group + follow the same conventions that get_absolute_url
already does. Some of the stuff, like resolved /api/0/organizations
is already available as a convenience method on the Organization
model as well.
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.
yeah good suggestion of adding the get_api_url option to Group .
I've added a p. basic one that follows the api docs but it also looks like get_absolute_url
has some additional parameters/conventions it can expect which I;m not too familiar with/not sure if they need to be accounted for in the get_api_url
method (I dont think so?)
/api/0/organizations is already available as a convenience method on the Organization model as well.
Can you point me to this part? I couldn't find seem to find it with a ctrl-shift-f /api/0/organizations
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.
Oh you're right, we only have org helper methods for web URLs don't we? 😅 Should we add one? Seems pretty useful for other contexts too.
) -> WebhookGroupResponse: | ||
|
||
webhook_payload = WebhookGroupResponse( | ||
url=absolute_uri(f"/api/0/organizations/{group.organization.slug}/issues/{group.id}/"), |
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.
maybe we use
sentry/src/sentry/models/group.py
Line 668 in feeaf39
def get_absolute_url( |
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 do use this in the below line for web_url
but it'll get the website link so we need another way to get the api_url
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #93780 +/- ##
==========================================
+ Coverage 81.66% 88.04% +6.38%
==========================================
Files 10330 10337 +7
Lines 596288 596719 +431
Branches 23163 23163
==========================================
+ Hits 486957 525380 +38423
+ Misses 108875 70883 -37992
Partials 456 456 |
query = None | ||
path = f"/issues/{self.id}/" | ||
if params: | ||
query = urlencode(params) | ||
return self.organization.absolute_api_url(path=path, query=query) |
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.
do we need to include query params? The published endpoint doesn't look like it takes any? https://docs.sentry.io/api/events/retrieve-an-issue/ :/
per - #93404 & getsentry/sentry-docs#8992
We were missing urls in the
issue.created
webhooks despite docs saying we had them. This PRadds
url,web_url
&project_url
according to the docs