Skip to content
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

Dashboards with source panel reloads every panel when scrolling to not yet shown one. #65627

Open
LukasJerabek opened this issue Mar 30, 2023 · 6 comments
Labels
needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc

Comments

@LukasJerabek
Copy link

What happened:
Hi, on a long dashboard with several panels, there are some that I cant see right away, I have to scroll down and such panels usually load when I scroll to them, which is perfectly fine. Panels previously loaded are not reloaded at such event. However in a case of sourcing the first panel in other panels, every panel is reloaded everytime I scroll down on a new panel.

In case of a big dashboard these reloads of all panels at the same time could be very resource demaning. On the other hand If only newly shown panel would load the dashboard would be just fine. This does not happen on a dashboard that does not source other panels.

What you expected to happen:
I expected only a newly scrolled to panel to load, not reload every panel on the dashboard. Same as on dashboards that does not source other panel.

How to reproduce it (as minimally and precisely as possible):
I have a table in postgres with timescaledb:

CREATE TABLE IF NOT EXISTS public.pid_ts (
    time_local timestamp with time zone NOT NULL,
    pid integer NOT NULL,
    uid integer NOT NULL,
    usr numeric NOT NULL,
    sys numeric NOT NULL,
    guest numeric NOT NULL,
    wait numeric NOT NULL,
    cpu_perc numeric NOT NULL,
    cpu smallint NOT NULL,
    minflt_per_s numeric NOT NULL,
    majflt_per_s numeric NOT NULL,
    vsz integer NOT NULL,
    rss integer NOT NULL,
    mem_perc numeric NOT NULL,
    kb_rd_per_s numeric NOT NULL,
    kb_wr_per_s numeric NOT NULL,
    kb_ccwr_per_s numeric NOT NULL,
    io_delay integer NOT NULL,
    threads smallint NOT NULL,
    fd_nr smallint NOT NULL,
    command text NOT NULL,
    PRIMARY KEY (time_local, pid)
);

SELECT * FROM create_hypertable(
    'public.pid_ts',
    'time_local',
    create_default_indexes => false
);

I have nameless transparent small (that way almost hidden) panel on my dashboard with this query:

select time_local, usr,sys,guest,wait,cpu_perc,minflt_per_s, majflt_per_s, vsz,rss,mem_perc,kb_rd_per_s,kb_wr_per_s,
kb_ccwr_per_s, io_delay, threads, fd_nr, command as metric FROM pid_ts
    WHERE $__timeFilter(time_local)
order by time_local, metric

I then use this panel in other panels like this:
image
and I do these transformations in each:
image

Anything else we need to know?:

Environment:

  • Grafana version: 9.4.7
  • Data source type & version: Postgres 14 + timescaledb 2.9.3
  • OS Grafana is installed on: Rocky Linux 8
  • User OS & Browser: Ubuntu + Brave
  • Grafana plugins: -
  • Others: -
@zuchka
Copy link
Contributor

zuchka commented Mar 31, 2023

do you think you could try and replicate this on our public sandbox, https://play.grafana.org? 🙏

@zuchka zuchka added the needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc label Mar 31, 2023
@LukasJerabek
Copy link
Author

I cant create new dashboard there, nor save the one I got linked to, could please explain how to show you the changes?

@LukasJerabek
Copy link
Author

LukasJerabek commented Apr 3, 2023

But basically you can create new panel on the dashboard as source use dashboard and choose server requests panel. Then in transformations use transformation called "Filter by name" and filter only time and web server 1. Do this for example 10 times, so that panels would not fit in the screen, and filter different server each time (and that cycle again from 1). You should see the problem as well there.

@LukasJerabek
Copy link
Author

@zuchka

@LukasJerabek
Copy link
Author

So I have worked on this and found this guide for sharing dashboards. https://grafana.com/docs/grafana/latest/troubleshooting/send-panel-to-grafana-support/#send-a-panel-to-grafana-labs-support.

Unfortunatelly, even though, i have tried to include lots of data, there is no visible loading, because it is not the same as when the data is retrieved from the database. However I will still include the dashboard here (just rename from share.txt to share.json and import the dashboard). There is "Reproduced with embedded data" panel which acts as a source panel from which all the panels below get the data. This way data are retrieved from db only once, even though used in multiple panels.

Here is the dashboard:
share.txt

But to show you exactly the real behaviour I have recorded video, where you can clearly see, that when I move onto not-yet-visible panel, then even the one already loaded is being RELOADED, even though the time span did not change. This is very unperformant. The worst thing is, that not only the previous panel gets reload, but every panel on the page gets reloaded everytime one scrolls down to the one not yet seen.

Screencast.from.2023-07-13.16-43-54.webm

I think this scenario has a lots of potential, just this little bug makes it less usable. I would be grateful if someone could look at this... @zuchka

@broqueSF
Copy link

I have the same issue (using Grafana v8.5.20) and it happens to any data source. To reproduce just:

  1. Create a Panel_1 with a query that takes at least a few seconds to execute.
  2. Create a Panel_2 that uses the result from Panel_1.
  3. Duplicate Panel_2 a few times so that you have to scroll down (the new panels are not in view when the page loads).
  4. Refresh the dashboard.
  5. Scroll after Panel_1 has loaded the chart and notice that as you scroll the other charts query again the data even though they use the result from Panel_1 that should have been loaded (and we should have got a boost in performance like mentioned here)

Looking in the Network tab I can see the query being sent again and taking the same amount of time to execute again. So it's really submitting the query instead of using the data that is already in the browser.

This idea of sharing the data source is great but seems that there is a bug in Grafana...

FYI @marcusolsson @zuchka @LukasJerabek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc
Projects
Status: 🗂️ Needs Triage / Escalation
Development

No branches or pull requests

3 participants