grafana-client icon indicating copy to clipboard operation
grafana-client copied to clipboard

Grafana Smart Query Prometheus missing key

Open PankajKhanwani opened this issue 2 years ago • 6 comments

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': []}}}

PankajKhanwani avatar May 03 '23 16:05 PankajKhanwani

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

amotl avatar May 03 '23 17:05 amotl

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

PankajKhanwani avatar May 08 '23 18:05 PankajKhanwani

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.

amotl avatar Oct 14 '23 00:10 amotl

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.

amotl avatar Jan 08 '24 22:01 amotl

Not yet. I will check it soon and will close this if everything works

PankajKhanwani avatar Jan 19 '24 18:01 PankajKhanwani

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.

amotl avatar Mar 29 '24 16:03 amotl