-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
feat(sourcemaps): Add logic to insert data into new debug ids table #44885
Conversation
🚨 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 |
0d6cc46
to
80477e9
Compare
size-limit report 📦
|
}, | ||
"files/_/_/index.js": { | ||
"url": "~/index.js", | ||
"type": "source", |
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.
source
cannot have debug ids, this has to be minified_source
.
|
||
schema = { | ||
"type": "object", | ||
"properties": { |
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 would put an projects
key into the schema and then allow the request to specify one or more projects for association. That would also mean that assemble_artifacts
takes a list of project IDs rather than one.
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.
Yep, I still didn't implement the new schema for the endpoint
src/sentry/tasks/assemble.py
Outdated
file_type = info.get("type", None) | ||
|
||
if debug_id is not None and file_type is not None: | ||
debug_ids_with_types.append((SourceFileType.from_lowercase_key(file_type), debug_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.
This could return None
, needs to be guarded against.
src/sentry/tasks/assemble.py
Outdated
files = manifest.get("files", {}) | ||
for filename, info in files.items(): | ||
headers = _normalize_headers(info.get("headers", {})) | ||
debug_id = _normalize_debug_id(headers.get("debug-id", None)) |
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 would explicitly check if the debug-id
is not None
before calling into normalize_debug_id
and swallowing the error there.
tests/sentry/tasks/test_assemble.py
Outdated
assert details is None | ||
|
||
for debug_id in debug_ids: | ||
debug_id_artifact_bundles = DebugIdArtifactBundle.objects.filter(debug_id=debug_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 dangerous to write code like this outside of tests becauase it can leak cross organization data (eg: same debug id existing in more than one org). Before someone copy pastes this elsewhere, please make sure that this has the organization_id
as constraint too.
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 yeah, thanks for the heads-up! I forgot about that
src/sentry/tasks/assemble.py
Outdated
debug_ids_with_types = [] | ||
|
||
files = manifest.get("files", {}) | ||
for filename, info in files.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.
Rename filename
to file_path
.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #44885 +/- ##
==========================================
- Coverage 80.24% 80.19% -0.06%
==========================================
Files 4725 4725
Lines 198780 199078 +298
Branches 12006 12030 +24
==========================================
+ Hits 159519 159646 +127
- Misses 38999 39170 +171
Partials 262 262
|
This PR aims at implementing the logic for extracting debug_ids information from the
manifest.json
of the uploaded.zip
artifact bundle.The new logic reads the updated
manifest.json
file and looks for theheader.debug-id
andproject
fields.A sample
manifest.json
can be seen here: