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
Explore: Loading query field takes too long and allows typing in it before it has loaded #52213
Comments
does the same thing happen also in dashboards? i suspect this specific to the plugin itself, not Explore. |
what seems to be happening, is that when switching the datasource, we try to apply the query from the "previous" datasource (like, switching from will look more into this. |
only happens in explore, not in dashbaords.
I can confirm this only happens when switching the datasource. If I open a new tab with the loki datasource and start typing a query before the labels have loaded, my query does not get deleted. |
i did some more investigation, and the bug seems to be in the generic grafana-explore-mode-code here: https://github.com/grafana/grafana/blob/main/public/app/features/explore/state/query.ts#L262-L295 what happens is, when switching between datasources, this part of the code is responsible for trying to represent the "query in previous datasource" somehow in this datasource. it calls various
to trigger this, the easiest i have found is to add some "sleep for 10seconds" code around https://github.com/grafana/grafana/blob/main/public/app/features/explore/state/query.ts#L290, something like this should do it: await new Promise((resolve) => {
setTimeout(resolve, 5000);
}); @grafana/observability-experience-squad could you take a look please? |
thanks for taking a look @gabor, my mistake. we'll look into this better. |
I wasn't able to reproduce it in the latest version. I think that with recent changes to mixed data sources in Explore the behavior changed and the editor is loaded only after queries are imported. In the case of Loki, importing queries may be slow if the request for getting labels is slow (Loki requires labels for importing to skip labels that do not exist). On the other hand, labels are cached so it's going to happen only once. A side effect of recent changes is that Explore shows the previous/stale editor until importing is complete (see video below). Maybe we should show the user that the query builder is loading? One more option is to skip importing if it takes too long, but maybe better would be better to add some logic to Loki plugin to skip label verification if it takes too long and simply use all provided labels. Screen.Recording.2022-09-16.at.14.32.55.mov |
this is still happening for me on v9.2.0-33906pre (469f915). Just tried it on an internal grafana instance. Can share this in a DM. Is it possible to just abandon the labels lookup if the user has typed something? Or if the initial prometheus query is empty? |
Yes, this could possibly be done in Loki plugin (cc @grafana/observability-logs) |
@dimitarvdimitrov sorry, could you explain in more detail, what is still happening for you?
thanks! |
I was replying to @ifrost's comment:
Whatever I typed into the query field after changing the datasource is still getting erased after the query is imported. |
@dimitarvdimitrov thanks for the info.. could you doublecheck something please? you see, both behaviours end the same way, except a minor detail: A (the original report):
B (what @ifrost described):
when you are switching between datasources of the same type, like Loki datasources, case A and case B looks very similar. could you please check, if you are seeing case A or case B? thanks! |
Should be fixed by #62747 |
What happened:
On the Explore page, the field for a query loads after a long while and deletes all that has been written in it before it has loaded fully. It takes around 10 seconds sometimes.
On the video: Reload the page. Change the datasource. Type in some random "query" just for the example. See the field load fully and delete your progress in the process.
Screen.Recording.2022-07-13.at.12.19.32.mov
What you expected to happen:
The field for the query either loads immediately, or it preserves the query I have written already once it the field has fully loaded.
How to reproduce it (as minimally and precisely as possible):
Open the Explore page and go to Code tab for the query operation.
Change the datasource and start typing a query for it. The field for a query loads after a while and deletes all that has been written in it before it has loaded fully.
Anything else we need to know?:
Discussed that it is an issue with @dimitarvdimitrov and is loading so slowly on his system.
Environment:
The text was updated successfully, but these errors were encountered: