GraphQL Data source - data path did not exist

Hi,
I recently came across the GraphQL data source for grafana.
I have the following which works pefectly on the GraphQL application:

query {
viewer {
zones(filter: {zoneTag: “abc”}) {
httpRequests1mGroups(limit: 20, filter: {datetime_gt: “2021-04-29T07:00:00Z”, datetime_lt: “2021-04-29T07:05:00Z”}) {
sum {
bytes
threats
}
dimensions{
datetime
}

  }
 }

}
}

Now according to the GraphQL for Grafana documentation, I am listing DataPath as httpRequests1mGroups , however I am still getting error data path did not exist.

Am I doing something wrong?
Can anyone help me please?

What does the returned data look like? The GraphQL response needs to include the specific DataPath key.

{
  "data": {
    "viewer": {
      "zones": [
        {
          "httpRequests1mGroups": [
            {
              "dimensions": {
                "datetime": "2021-04-29T07:05:00Z"
              },
              "sum": {
                "bytes": 118313878,
                "threats": 50
              }
            }
          ]
        }
      ]
    }
  },
  "errors": null
}

Thanks for sharing! So looking at that, do you see how your dataPath may need to be adjusted, or is it not yet clear?

I’ve tried
httpRequests1mGroups.sum
httpRequests1mGroups.dimensions.sum
zones.httpRequests1mGroups
zones.httpRequests1mGroups.sum

It seems i’m not getting the correct way.
I cannot change the output structure.

@justincilia1 I think you need to include everything after data in the path, i.e. viewer.zones.httpRequests1mGroups. I also see that zones itself is an array, so you may need to add an index (like zones[0]) - though I’m not totally sure how the path needs to be formulated for this to work.

Sorry, I don’t have an intimate familiarity with how the paths are parsed by the GraphQL plugin and how cases like this need to be treated. If looking at the docs doesn’t work, it may be worth trying to reach out to the developer on Github.

@svetb , just to let you know I managed to get data from using dataPath as viewer.zones

1 Like

This topic was automatically closed after 365 days. New replies are no longer allowed.