grafana-client
grafana-client copied to clipboard
Grafana Smart Query Prometheus missing key
Describe the bug
result = grafana.datasource.smartquery(datasource=datasource, expression='openstack_nova_total_vms')
I have called smartquery for the type=prometheus.
This function doesn't take from and to keys which is required to call grafana for the prometheus query, otherwise it is giving 200 ok but the output doesn't contain any data. But if provided with timestamp in from and to it gives the data.
This is the result:
{'results': {'A': {'status': 200, 'frames': []}}}
Dear Pankaj,
thank you for writing in. Up until now, the smartquery subsystem has been primarily conceived to check datasources for health, see references below. That's probably the reason why many of the implementations are only stubs, and lack corresponding parameter propagations.
On the specific issue of improving the support for Prometheus on this matter, I think @peekjef72 already submitted corresponding improvements - at least this code fragment looks like that.
https://github.com/panodata/grafana-client/blob/b37a67b0fe5a0843cc4b1d256eff01176894e50c/grafana_client/elements/datasource.py#L315-L330
With kind regards, Andreas.
References
- GH-20
- GH-38
Thanks @amotl, will be looking forward to use this library once this code gets merges. If any bugs found, will surely contribute to the repo
Dear Pankaj,
the improvements to the library by @peekjef72 have been merged. Maybe you are more successful now to run your query? We will be happy to hear back from you about it.
With kind regards, Andreas.
Dear @PankajKhanwani,
first of all, we would like to wish you a happy new year. Also, we want to take the chance to ask you whether you had the chance to check if querying Prometheus through grafana-client works well now, when using a recent release?
With kind regards, Andreas.
Not yet. I will check it soon and will close this if everything works
Gentle ping ;]. We just released grafana-client 4.0.0 with a few more enhancements. Please let us know if the current version improves the situation for you. We would otherwise like to look into it, in order to improve functionality for you and others needing it.