Hi,
I installed Grafana 11.0.0 and I’m using Wild Graphql Data Source to create a dashboard for my website analysis. I create a graphql query like this to get total visits for the selected range time:
query {
viewer {
accounts(filter: { accountTag: “account_tag” }) {
total: rumPageloadEventsAdaptiveGroups(
filter: {
AND: [
{
datetime_geq: “${__from:date:iso}”,
datetime_leq: “${__to:date:iso}”
But I get this error: {
“error parsing args for "rumPageloadEventsAdaptiveGroups": filter: AND: datetime_geq: not an iso8601 time”.
When I enter the start and end date manually, the query worked perfecly. But it didn’t work when using functions like: ${__from:date:iso} or ${__from:date}.
I wanted to chime in, as I’m the creator of Wild GraphQL datasource and am just now seeing this. (Feel free to @mention me if you need help in the future)
Unlike most other Grafana plugins, Wild GraphQL Datasource does not allow you to use Grafana’s variable interpolation in the query itself. Most of the time, you don’t need to use anything like ${__from} or ${__to}, but instead you can use the $from and $to variable provided to each query.
I won’t go into detail on that, as it looks like you instead want to use the ISO date format ${__from:date:iso} and ${__to:date:iso}. You cannot use these values directly inside the query. Instead, you can do something like this:
query:
query ($fromIso: String!, $toIso: String!) {
# Now you can reference $fromIso and $toIso within your query
# ...
}
The idea here is that interpolation is only allowed to happen in the variables section of the GraphQL query. This allows the GraphiQL editor or an external GraphQL query validator to validate each GraphQL query without worrying about how each interpolation could affect or break the GraphQL query.
I’m guessing I’m a little late to replying and this isn’t useful anymore, but hopefully it will help someone in the future.