-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(processing): Enable Node.js Source Maps #6626
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
Conversation
# therefore we only process user-land frames (starting with /) | ||
# or those created by bundle/webpack internals | ||
if self.data.get('platform') == 'node' and \ | ||
not frame.get('abs_path').startswith(('/', 'app:', 'webpack:')): |
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.
Are we sure this is correct? There is no rule about which files might or might not appear in sourcemaps. For react-native i'm pretty sure we saw a bare 'index.bundle' as filename.
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 cannot give a definite answer, but I wasn't able to attain any other result than the one above and I tried a lot of variants.
@@ -50,7 +50,7 @@ | |||
) | |||
manager.add(43, "user_tracking", "User Tracking", "code", prerequisite=["first_event"]) | |||
manager.add(44, "custom_tags", "Custom Tags", "code", prerequisite=["first_event"]) | |||
manager.add(45, "source_maps", "Source Maps", "code", prerequisite=["first_event", "javascript"]) | |||
manager.add(45, "source_maps", "Source Maps", "code", prerequisite=["first_event", ("javascript", "node")]) |
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.
Does this work?
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.
Yes, see
prerequisite=["first_event", ("python", "javascript", "node", "php")] |
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.
Just some feedback here, but this is ultimately @ehfeng's decision:
I'm not sure I'd group node under this feature tracking flag thing. Source maps in node are generally less common and I wouldn't say "required" in the same sense as they are for browser js. And not sure if we'd want to say, using node sourcemaps also toggles this for browser js since I assume setup is going to be entirely different.
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, this is fine, but I'm really curious how this is going to look on the other end and how raven-node is adapting to send the correct data we need.
Ideally, we're determining if we need sourcemaps from the SDK first, and making sure we tag the payloads correctly so it can be identified. The difference here, which is probably obvious, is that sometimes Node doesn't need it, and sometimes it does. Whereas with JS today, we make strong assumptions that we 100% need additional processing.
Mostly just iterating that the discovery side of things I think needs to happen within the SDK since it'd know easier than the server. Unless you have a better idea for how the whole picture works, I might be thinking of things differently.
@@ -50,7 +50,7 @@ | |||
) | |||
manager.add(43, "user_tracking", "User Tracking", "code", prerequisite=["first_event"]) | |||
manager.add(44, "custom_tags", "Custom Tags", "code", prerequisite=["first_event"]) | |||
manager.add(45, "source_maps", "Source Maps", "code", prerequisite=["first_event", "javascript"]) | |||
manager.add(45, "source_maps", "Source Maps", "code", prerequisite=["first_event", ("javascript", "node")]) |
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.
Just some feedback here, but this is ultimately @ehfeng's decision:
I'm not sure I'd group node under this feature tracking flag thing. Source maps in node are generally less common and I wouldn't say "required" in the same sense as they are for browser js. And not sure if we'd want to say, using node sourcemaps also toggles this for browser js since I assume setup is going to be entirely different.
@mattrobenolt the way I would like to treat this going forward is that SDK does not determine processing. For some cases we will want to move processing into the relay agent at one point and the less specific config is required to trigger that the better. |
The main difference between browser JS and node JS is that latter requires both, frame URLs rewrites and manual source maps upload (or using our webpack plugin, as I do now locally – will add it as a doc entry). Where for the browser it can be skipped completely, as we can pull the code and maps from the server (and/or scrape the modules if necessary). |
I'm not sure if we shouldn't disable scraping for node: if self.data.get('platform') == 'node':
self.allow_scraping = False
else:
self.allow_scraping = self.project.get_option('sentry:scrape_javascript', True) |
@mitsuhiko I tried to use both tactics, mocking |
Generated by 🚫 danger |
@kamilogorek if you want i can finish the tests |
That'd be very helpful, thanks @mitsuhiko! I need some assistance delivering this feature.
Tests are the only thing left now. |
85a4f08
to
d4f7e96
Compare
merging and praying per @kamilogorek's request |
I still need to add proper tests for this but wanted to make sure that I'm on the right track and my implementation is decent enough.