Skip to content

feat(open-pr-comments): get sentry projects and filenames #59952

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 4 commits into from
Nov 15, 2023

Conversation

cathteng
Copy link
Member

Reverse code map filenames from Github (source_root) to filenames as stored in Sentry (stack_root). Also fetch the projects associated with these code mappings.

For ER-1807

Copy link

codecov bot commented Nov 15, 2023

Codecov Report

Merging #59952 (609597b) into master (301ebf6) will increase coverage by 0.00%.
Report is 13 commits behind head on master.
The diff coverage is 94.73%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #59952   +/-   ##
=======================================
  Coverage   80.76%   80.76%           
=======================================
  Files        5179     5179           
  Lines      227391   227401   +10     
  Branches    38253    38255    +2     
=======================================
+ Hits       183654   183663    +9     
  Misses      38145    38145           
- Partials     5592     5593    +1     
Files Coverage Δ
...lease_thresholds/release_threshold_status_index.py 83.87% <100.00%> (-0.21%) ⬇️
src/sentry/tasks/sentry_apps.py 85.29% <100.00%> (ø)
static/app/utils/releases/releasesProvider.tsx 72.97% <ø> (-0.72%) ⬇️
...entry/tasks/integrations/github/open_pr_comment.py 98.07% <93.33%> (-1.93%) ⬇️

... and 2 files with indirect coverage changes

@cathteng cathteng requested a review from a team November 15, 2023 00:46
@cathteng cathteng marked this pull request as ready for review November 15, 2023 00:46
@cathteng cathteng requested a review from a team as a code owner November 15, 2023 00:46
Copy link
Contributor

@nhsiehgit nhsiehgit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just comment on the raw sql 🤔

Can we chat w/ maybe @wedamija or someone and see if there's any better alternative?

Comment on lines +90 to +92
RepositoryProjectPathConfig.objects.filter(organization_id=org_id)
.annotate(substring_match=StrIndex(Value(pr_filename), "source_root"))
.filter(substring_match=1)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StrIndex returns the index in which there is a match, but uses 1-indexing. it returns 0 if there is no match

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: is this case-sensitive?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm assuming it works like regular string indexing, but i can check

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently it depends on the DB backend used. In our case it's PostgreSQL, where it's rendered as STRPOS(), which is indeed case-sensitive.

@cathteng cathteng force-pushed the cathy/open-pr-comments/get-sentry-filenames branch from 99fbbb9 to 609597b Compare November 15, 2023 19:45
@cathteng cathteng merged commit b2fd4a6 into master Nov 15, 2023
@cathteng cathteng deleted the cathy/open-pr-comments/get-sentry-filenames branch November 15, 2023 20:34
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants