Dedicated symbolication tool#5123
Conversation
There was a problem hiding this comment.
Thanks, this looks reasonable, what do you think @mstange ?
I've left a few comments to be fixed before landing but this looks OK to me otherwise. Of course you'll also need to fix the red CI, please ping if you need assistance on these.
It would also be good to add some simple tests exercising the code too.
|
Note that |
|
Alright, that's everything in CI green apart from one issue with flow. Could I get some help with that? I have no idea why it finds the indicated code problematic. For tests: I can have a try but I'm not sure about the best approach to take. I assume that the components I've stitched together already have unit tests. You want something like an e2e test? |
|
For the flow error, I think this is because our (quite old) version of flow doesn't know about top level await, even though that's a thing for some time now. The fix would be to put all your top level code in an async function (maybe call it
As a test, if you do this |
|
This is a great idea! I was hung up on thinking we needed to publish an npm module to unlock this use case. But just having a way to run symbolication from the command line if you have a clone of this repo around - that's so much simpler! I think this would help our Firefox CI use case as well. |
Are you sure? My (limited) understanding of NodeJS and promises is that putting the code in an async function and calling it would immediately return a
Alright, can do. I assume it's OK to have some test resources in the repo for this, i.e. non-symbolicated and symbolicated traces + a set of saved symbol-table responses for the mock to supply? |
I think Node will wait if we let it exit "naturally" (that is without calling process.exit). Please tell me if you see otherwise. Updating flow is very painful for a project our size -- we want to move to typescript but haven't done that yet...
Yes it's definitely OK, just try to make them not too big :-) |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5123 +/- ##
==========================================
+ Coverage 88.40% 88.56% +0.16%
==========================================
Files 305 307 +2
Lines 27716 27794 +78
Branches 7515 7525 +10
==========================================
+ Hits 24501 24616 +115
+ Misses 2981 2961 -20
+ Partials 234 217 -17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
julienw
left a comment
There was a problem hiding this comment.
Hi @richard-fine , this looks good to me, with the changes I added to the PR in Unity-Technologies#11
Once it's merged (but of course tell me what you think) I'll be able to merge to main!
* Rename the output file to better reflect the directory name * Add a comment at the top of the symbolicator file, to explain how to run it * Minor test adjustments * Add the symbolicator build to the CI
|
@julienw I've merged your small modifications, thanks for those! Don't merge this just yet though - I am not totally sure that the integration test is valid yet. |
|
The expected value for my integration test was actually not symbolicated, and yet the test was passing. What I discovered was that the code I'd added to my custom SymbolStore implementation to dump out the symbol server response (to create Either way, I'm now confident that the test is actually working, so if you are happy enough with the code coverage, I think it should be OK to proceed to merge. |
It's surfaced in the profiler/src/profile-logic/symbolication.js Lines 891 to 899 in 5d53dcb I believe
|
I can't change the PR so I can't make it uptodate. Can you please click the |
|
Just merged, thanks for your contribution! |
[Julien Wajsberg] Two optimizations for the marker chart (#5121) [Nazım Can Altınova] [Tab selector 5] Add a tab selector component and implement tab switching (#5093) [Julien Wajsberg] Support profiling from the toolbox in Thunderbird Release (#5135) [Richard Fine] Add a dedicated symbolication tool (#5123) [Julien Wajsberg] Export a tool to extract gecko logs from a profile (#4973) Shout-out to our localizers: de: Michael Köhler el: Jim Spentzos en-CA: chutten en-GB: Ian Neal es-CL: ravmn fr: Théo Chevalier fy-NL: Fjoerfoks ia: Melo46 it: Francesco Lodolo [:flod] nl: Mark Heijl pt-BR: Marcelo Ghelman ru: Valery Ledovskoy sv-SE: Andreas Pettersson uk: Lobodzets zh-CN: Olvcpr423 zh-TW: Pin-guang Chen
Hello, Firefox team! I have been working with @vvuk on adopting Samply + the Firefox profiler tooling into our development processes at Unity. We thought you might be interested in this change that I put together over the past couple of days.
Problem
When creating a capture using a tool such as Samply, the trace is not initially symbolicated; symbolication is done on-demand, when loading the trace into the frontend.
The downside of this is the the trace file is not really portable - if you move it to another machine, you likely won't be able to symbolicate it, as the symbols might not exist on that other machine.
It's possible to work around this problem by launching the frontend immediately and triggering symbolication, but it's a bit awkward to do this, particularly in automation scenarios; it means launching and puppeteering an entire browser, and if Samply is being run on a machine where the default browser is, say, Safari, then it doesn't actually work correctly because of Safari's CORS behaviour with localhost.
Proposed solution
In order to avoid the need to launch an entire browser to get a profile symbolicated, this PR adds a small standalone NodeJS-based tool which can be run as a CLI process to symbolicate a profile. The components used by the frontend are reused so that the logic is shared, they're just packaged together into a minimal app with no React/Redux, etc.
Once built, the tool is at
dist/symbolicator.js.Usage
Future
Over time I'd like to try and integrate this logic directly into Samply (improving/replacing the
--unstable-presymbolicateoption that was recently added to it), but as someone who has only rudimentary Javascript and absolutely zero Rust, that'll take me a while :) so this tool might be a helpful step in the meantime.I also looked into packaging the tool as an SEA, as I'd like to avoid having to carry around an entire Node install just to run this one script. However, there's a couple of supporting files that webpack produces (one of which is a WASM) and I'm not totally sure how to fix that up so it can be packaged correctly.