Implement link sharing for 3P
Hi, here is some background of my request. In the recorded trace I want to highlight a time where the interesting thing happened. I can do it via UI, but I want it to be automatic and when the user opens it, it is already there (Let's assume I already know the 'proper' timestamp to use in this task).
In Chrome trace I can easily add a global 'instant event' (ph='i') to an existing trace and draw a vertical line to highlight the time. How can I do it to an already recorded perfetto trace? (via a json merge would be nice so I do not need to parse the Perfetto trace myself).
I see the same Chrome event is supported via Perfetto's TrackEvent, so I hope it is not too much to ask for the request.
Thx.
For a long time, Googlers have had the ability to share traces with the state of the state preserved. Here's an example: https://ui.perfetto.dev/#!/?s=49a3cf8faf432f3fc5dc91e25b248ba5cb1f4c45
But this was not open to external users due to privacy and security reasons.
But @stevegolton is going to be looking into opening this up to external users. Once we have this, should just be a matter of marking a point in the trace, clicking "Share" and everything else will just work.
Sharing is an awesome function, but it does not really replace the need of the asked function since the effort of marking on the trace for the first time could also be saved if the time is already known (in many cases, that is true) before the trace is opened.
So let me break down the options:
- if you want to have a single "top level track" that you want visible at the top, you can wait for https://github.com/google/perfetto/issues/1018 and then include a synthetic trace with the timestamp that opens at the top of the trace (see note below)
- If you wanted to actually have an automatic "note" in the UI based on the presence of some event (i.e. similar to note in the trace Is hared above), I think we'd be open to a contribution to a UI plugin which would allow users to write an SQL query and then create notes automatically for every timestamp where that SQL query matches.
- You can always fork the UI and have your own version which integrates a plugin to do this. Would solve this problem as well without the user needing to type the SQL query e.g. in a setting.
Note on 1): Just to be clear, global instants with TrackEvent but they work very differently to the chrome://tracing intentionally (global instants there were a mess because everyone decided their event was "important" and spammed it making traces unreadable.).
This is how instants work with Perfetto:
Thanks for the explanation - I think #1 is what I was after - #2 also sounds promising and visually more appealing too.
Put some more thought into this: this is overlapping somewhat with https://github.com/google/perfetto/issues/1342: we are adding the ability to run commands on UI startup and also, using URL parameters, allowing people to customize "I want X, Y, Z commands to run on startup".
So implementing 2) might just be a matter of adding a UI plugin which contributes a command for "create a note at each timestamp from the given SQL query". So then you can ask your users to add something to their UI which runs that command on startup or if you're using deep linking, you can generate a URL which runs that command with the SQL query on startup.
If #1342 can be expanded so the user can create 'an annotation on the fly' via some URL parameters - that would be exactly what we need here - can the timestamp of the annotation (most important attr) support the UTC form?
Yeah we can probably implement a plugin command which, for a given UTC timestamp, adds an annotation at that timestamp.
https://github.com/google/perfetto/pull/2670 adds the command described above.