I am working on a custom plugin that handles data fetching manually using the grafana query proxy. Currently, I am tracking refresh events and using that as a trigger for a new fetch request because I wanted to capture the functionality that if a user presses the refresh button it should refetch data in the panel.
However a side effect of this is that if any other panel triggers a refresh event it will cause an otherwise unaffected instance of my plugin to refetch. This is unintended as the default behavior for Grafana standard components is that they won’t refetch for every refresh event. As context I do not have automatic refreshes enabled, and they will not be enabled for the scope of my plugin use cases.
The issue that I am having is that looking into the EventBus to track refresh events, there doesn’t seem to be any way of differentiating refresh events, or telling where they were initiated from. It seems this was changed somewhat recently, as there is old documentation that references fields in the EventBus that do not exist anymore.
How can I differentiate between refresh events so my plugin isn’t needlessly refetching data when it doesn’t need to, matching the default behavior of other standard Grafana visualizations?
(The eventBus source code can be found here, and there is no clear way to tell the difference of any refresh event.
grafana/packages/grafana-runtime/src/services/appEvents.ts at main · grafana/grafana · GitHub )
What am I missing?!
Thanks in advance