-
Notifications
You must be signed in to change notification settings - Fork 243
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
Support importing partial JSON files #202
Conversation
Partial files are allowed in many specs, e.g. Trace Event Format, so the viewer should be able to load partial files as well.
Hey @jlfwong , could you please review that change? Thanks! |
@loganek Hi! My home internet has been down for the last week, but I'll try to get to this soon! I'm generally wary of adding third party dependencies, but I took a look at I'll try to take a closer look later this week, merge if I don't find anything concerning, then do a release that picks this up. Out of curiousity, were you motivated to do this because you have Chrome trace profiles that are not terminated? What was generating them? |
@jlfwong So sorry, I didn't want to rush you at all! Just thought that you missed the PR, so wanted to ping you, but please take your time, it's not super urgent for me. Yeah, I wasn't sure what's your opinion about third party dependencies, but since it wasn't very time consuming, I decided to give a try. Yes, I did this PR exactly because my files are not terminated; those files are generated by hawktracer-converter (https://github.com/loganek/hawktracer-converter/) which is a client app of my profiler (https://github.com/amzn/hawktracer). I guess I could work-around this in the converter to close the file properly, but since the format specification allow to have non-terminated files, I thought it'd be more correct to fix your viewer instead. Btw. great tool, it feels much faster than the one embedded to chrome, and flamegraphs is a nice feature too. Good job, and thanks for doing that :) |
This is great as is :) Thanks for taking the time to carefully craft this PR! |
@loganek Ah... sorry I spoke too soon. I had to revert the commit because The repository now depends upon The specific cases of partial json files supported by the Trace Event Format is also a small subset of what that module tries to support. For example, it doesn't support unterminated strings. In fact, as far as I can tell, the only allowance it specifies is this:
(From https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#). So I think retrying import after appending a |
This PR introduces support for importing JSON based profiles that are missing a terminating `]` (and possibly have an extraneous `,`). This is similar to #202, but takes a much more targeted and simple approach. I'm confident that this approach is sufficient because this is exactly what `chrome://tracing` does: https://github.com/catapult-project/catapult/blob/27e047e0494df162022be6aa8a8862742a270232/tracing/tracing/extras/importer/trace_event_importer.html#L197-L208 Fixes #204
Partial files are allowed in many specs, e.g. Trace Event Format,
so the viewer should be able to load partial files as well.