Add an option to `Refresh` the metrics graph with the latest data
A Grafana-like option to auto-refresh the metrics graph with the latest data without user intervention.
Open questions from Discord discussion:
1. Is it an auto-refresh toggle that refreshes the graph say every 10s, or is it a button that needs a manual click whenever we need the graph refreshed?
..
2. Would it update the timestamps in the URL or fetch data for the same timestamps in the URL?
I'm uncertain if the later will make any difference in the graph on refresh. Since the data gets accumulated as time progresses, and we don't go back in time and update anything. So, I assume if the timestamps remain the same, then there will be no update in the data. Please correct me if I'm wrong.
3. Need to maintain shareability.
I guess, this one overlaps both of the above questions. If we auto-refresh the graph, updating the URL timestamps, then we lose shareability.
4. The auto-refresh pauses if there is an interaction on the graph.
..
@brancz @metalmatze @yomete I have summarized the open questions from Discord, and I have added my thoughts below each of them as well. Please share your thoughts on each item as well.
After thought: Having spent time thinking about this feature, it sounds like it makes a lot more sense for standalone dashboards than for a tool like Parca where users mainly dig into the data.
I would suggest we can try auto-refresh as a toggle next to search maybe? And if there is any interaction, on the graph (as you mentioned) or even hitting search it disables it. Beyond that, I think that refreshing should not be part of the URL at all. I think share-ability might get a bit weird that way but I'm happy to try it out, it might work out this way.
On 2:
If you open a series with Parca and click on search the timestamps are part of the URL. Now if you click on search again the timestamps from and to are both updated.
For a refresh button we have to do the same. Every 10s both timestamps need to be updated to Date.now() and Date.now() - 3600 (example with 1h). Otherwise we always just refresh the same graph and will never show new samples...
On 3: I don't see how we lose the sharability? Sure, I get slightly updated timestamps every now and then but whenever I want to share that specific page I can do so and it will just show up for that person the same way (assuming refreshing won't just be enabled for them right away too)
Sounds good. Let's try it then.
@manojVivek thoughts on this? is this something we still want to do or shall we close it?
I think, this is not something that fits in with how our users use the app, so this can be closed.