2

I am trying to create a query that groups the data by "Api" field and selects a value field by using prometheus and grafana.

My sample query (promql) is max (application_apidbacesscount_total) by (Api) [30m:1m]. This works for getting max value with grouping the data by "Api" field.

How can i do that using grafana's panel? Is it possible to give Grafana a base query and modify it with panel fields?

umutcanturan
  • 78
  • 1
  • 8

1 Answers1

3

You have to add a new widget and add the query:

max(rate(application_apidbacesscount_total[$__range])) by (Api)

enter image description here

Using [$__range] instead of a fixed range will apply the values of rage selector from Grafana

wolmi
  • 1,659
  • 12
  • 25
  • Thank you for your answer. I don’t have “application_apidbaccess_total”. I am using CounterOptions as metric registry. What should I do to get the application_apidbaccess_total? In addition, my main purpose is get rid of the “max” function. I want to call aggregate functions from grafana. Is that possible? – umutcanturan Jul 08 '20 at 12:21
  • In order to properly answer, can you share some real metrics? – wolmi Jul 09 '20 at 06:54