These tests are related to this Epic: grafana/grafana#37784
- Create new prometheus
prometheus-demo
data sources that points to http://demo.robustperception.io:9090, choose server(default) access - Each tests starts with plain Explore or Dashboard state
- Select
prometheus-demo
data source
The easiest way how to test if the results are correct is to use split mode run the same queries with 1 difference. 1 pane will run queries with Examplars
toggled on (queries run trough proxy) and the other will run queries with Examplars
toggled off (queries run trough backend). The results should be always same with 1 exception. When running Both
query type, the name of the Value field in table is Value #A
in the case where we run query trough proxy and Value #A_instant
when we run it troough backend. This is correct because when running queries trough backend, we need to have unique refId for both queries and therefore for instant queries we are adding _instant
.
Just compare table & graph results:
- Run
ALERTS{alertstate="firing"}
withInstant
query type. - Run
ALERTS{alertstate="firing"}
withRange
query type. - Run
ALERTS{alertstate="firing"}
withBoth
query type.
Just compare table & graph results. Don't forget to have both queries without exemplars when testing backend:
- Run
ALERTS{alertstate="firing"}
withInstant
query type AND{event="add"}
withInstant
query type. - Run
ALERTS{alertstate="firing"}
withInstant
query type AND{event="add"}
withRange
query type. - Run
ALERTS{alertstate="firing"}
withInstant
query type AND{event="add"}
withBoth
query type. - Run
ALERTS{alertstate="firing"}
withRange
query type AND{event="add"}
withInstant
query type. - Run
ALERTS{alertstate="firing"}
withRange
query type AND{event="add"}
withRange
query type. - Run
ALERTS{alertstate="firing"}
withRange
query type AND{event="add"}
withBoth
query type. - Run
ALERTS{alertstate="firing"}
withBoth
query type AND{event="add"}
withInstant
query type. - Run
ALERTS{alertstate="firing"}
withBoth
query type AND{event="add"}
withRange
query type. - Run
ALERTS{alertstate="firing"}
withBoth
query type AND{event="add"}
withBoth
query type.
In Explore, we support following template variables. To test if they were interpolated correctly, open the Inspector -> Query tab, run query and check what valiu was used. In backend queries, it is visible under request > data > queries[0] > expr > ...query[240s]
. In proxied query it is visible in the url such ass api/datasources/proxy/38/api/v1/query_exemplars?query=rate(ALERTS%7Balertstate%3D%22firing%22%7D%5B240s%5D)&start=1629894120&end=1629897720
.
- Run
rate(ALERTS{alertstate="firing"}[$__interval])
withRange
query type, Minimum step 40m and time range 1h. (interval should be 2400s) - Run
rate(ALERTS{alertstate="firing"}[$__interval])
withRange
query type, Maximum step 5s and time range 1h. (interval should be 5s) - Run
rate(ALERTS{alertstate="firing"}[$__interval])
withRange
query type, Minimum step 40m and time range 30d. (interval should be 3600s or 1h) - Run
rate(ALERTS{alertstate="firing"}[$__interval])
withRange
query type, Maximum step 40m and time range 30d. (interval should be 2400s) - Run
rate(ALERTS{alertstate="firing"}[$__rate_interval])
withRange
query type, Minimum step 40m and time range 31h. (rate_interval in bracket should be 9600s) - Run
rate(ALERTS{alertstate="firing"}[$__range])
withRange
query type, Maximum step 40m and time range 1h (range in bracket should be 3600s)
Hide 1 query. Then hide the other query. And lastly hide both.
- Run
ALERTS{alertstate="firing"}
withInstant
query type AND{event="add"}
withInstant
query type