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

Grafana crashes when attempting to perform filter on json path #285

Open
doanbutar opened this issue Jun 28, 2022 · 2 comments
Open

Grafana crashes when attempting to perform filter on json path #285

doanbutar opened this issue Jun 28, 2022 · 2 comments

Comments

@doanbutar
Copy link

What happened?

Grafana crashes when attempting to use ?$filter on the JSON API path

This occurs even when I’m not using the dashboard variable outside of the dashboard
When using Azure Monitor to perform the same, it Grafana converts the variable into the correct data for the Explorer view, how come doesn’t occur during this method?
What I’m seeing occur is as soon as I include the $ simple into my queries in Explore, Grafana breaks.

What was expected to happen?
Allow me to filter as part of the API request

Steps to reproduce the problem:

  1. Either via Explore or Variable perform a query using JSON API data source
  2. Set the path to /DesktopMachines?$
  3. Site crashes with attachments

What is working?
Added ?

<Grafana URL>/explore?orgId=1&left=%7B%22datasource%22:%22Pepper-CitrixCloud%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22cacheDurationSeconds%22:300,%22method%22:%22GET%22,%22queryParams%22:%22%22,%22urlPath%22:%22%2FSessionActivitySummaries%22,%22fields%22:%5B%7B%22jsonPath%22:%22$.value%22%7D%5D%7D%5D,%22range%22:%7B%22from%22:%22now-1h%22,%22to%22:%22now%22%7D%7D

What is not working?
Added $

<Grafana URL>/explore?orgId=1&left=%7B%22datasource%22:%22Pepper-CitrixCloud%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22cacheDurationSeconds%22:300,%22method%22:%22GET%22,%22queryParams%22:%22%22,%22urlPath%22:%22%2FSessionActivitySummaries%3F$%22,%22fields%22:%5B%7B%22jsonPath%22:%22$.value%22%7D%5D%7D%5D,%22range%22:%7B%22from%22:%22now-1h%22,%22to%22:%22now%22%7D%7D

As I’m trying to use $filter which works within the Dashboard and variable queries, it’s in Explore where it breaks. Even if I copy /DesktopGroups?$filter=Name eq ‘Prod - Win2016 Silo NetSol - AUSYCTXVA3P, which the qualified query for one of my variables, Explore still crashes.

Version numbers:
Grafana 9.0.2
JSON API - 1.3.1

@doanbutar
Copy link
Author

I just tested and Explorer only crashes when the $ was being introduced, not when the URL construct is incorrect.

As per the below screenshot, the filter is not being introduced, that section is completely ignored and still returns valid data,
image

Here is the expansion of one of the objects showing that the filter is not introduced as we are not calling it
image

Here is an example of if the URL is incorrect and data doesn’t get returned.
image

I don’t think that is exactly happening here because if the plugin was thinking it was a variable, I would imagine this would occur in all areas of the product rather than just under the Explore context.
To add further, to the strangeness, when I run the following path below, it works fine

/SessionActivitySummaries?$orderby=SummaryDate desc
image

On further inspection as well, I noticed a strange even occurring when viewing the query history. As to why $orderby was working and it appears to be something relating to the data source occurring.

As you can see below, my query now works when running from query history
image

As you can see, it has introduced the azureMonitor data source for some reason?

Here are some of my queries I was running a while ago (still after the 13/6) as well, I think these are from when I use the explore option for the panel.
image

Here are the queries on the 13/6 or before where I believe the issue was first occurring which seems to be resolved now as when I run the query from history, it works as expected.
image

@ollisco
Copy link

ollisco commented Jul 27, 2022

Have you tried adding your filter to the params instead of directly in the path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants