graphql-datasource
graphql-datasource copied to clipboard
Query Option "Relative time" and "Time shift" not working
Describe the bug I want to show data from yesterday in a stats panel. If I use "relative time" or "time shift" option, both are ignored. It doesn't matter what I try to insert in the two fields
Expected behavior The options have an impact on the GraphQL query.
Screenshots
Apparently this is a feature/limitation of the $__from
and $__to
variables, they are globally scoped to the dashboard (see https://github.com/grafana/grafana/issues/38954). There are still the older datasource-specific $timeFrom
and $timeTo
variables that we deprecated, which should still work and may include the panel adjustments, but they are epoch timestamps only (see #10, which was closed with the recommendation to use the global variables).
So we'll need to look again at providing a datasource-specific macro for configurable timestamps.
Thank you for your answer.
In addition, I have tested the behavior with the PostgreSQL data source.
The PostgreSQL plugin uses a time filter macro in the where part of the query:
The dashboard uses the global time scope, but you can add a time shift to a single panel to show an other time. With this feature, you can for example show the data from today (selected with the global dashboard range) in addition with a panel in the dashboard, that shows the data from yesterday.
I would really appreciate this feature for the GraphQL data source plugin.