These tests are related to this Epic: grafana/grafana#37784
- Create new prometheus
prometheus-demodata sources that points to http://demo.robustperception.io:9090, choose server(default) access - Each tests starts with plain Explore or Dashboard state
- Select
prometheus-demodata 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"}withInstantquery type. - Run
ALERTS{alertstate="firing"}withRangequery type. - Run
ALERTS{alertstate="firing"}withBothquery type.
Just compare table & graph results. Don't forget to have both queries without exemplars when testing backend:
- Run
ALERTS{alertstate="firing"}withInstantquery type AND{event="add"}withInstantquery type. - Run
ALERTS{alertstate="firing"}withInstantquery type AND{event="add"}withRangequery type. - Run
ALERTS{alertstate="firing"}withInstantquery type AND{event="add"}withBothquery type. - Run
ALERTS{alertstate="firing"}withRangequery type AND{event="add"}withInstantquery type. - Run
ALERTS{alertstate="firing"}withRangequery type AND{event="add"}withRangequery type. - Run
ALERTS{alertstate="firing"}withRangequery type AND{event="add"}withBothquery type. - Run
ALERTS{alertstate="firing"}withBothquery type AND{event="add"}withInstantquery type. - Run
ALERTS{alertstate="firing"}withBothquery type AND{event="add"}withRangequery type. - Run
ALERTS{alertstate="firing"}withBothquery type AND{event="add"}withBothquery 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])withRangequery type, Minimum step 40m and time range 1h. (interval should be 2400s) - Run
rate(ALERTS{alertstate="firing"}[$__interval])withRangequery type, Maximum step 5s and time range 1h. (interval should be 5s) - Run
rate(ALERTS{alertstate="firing"}[$__interval])withRangequery type, Minimum step 40m and time range 30d. (interval should be 3600s or 1h) - Run
rate(ALERTS{alertstate="firing"}[$__interval])withRangequery type, Maximum step 40m and time range 30d. (interval should be 2400s) - Run
rate(ALERTS{alertstate="firing"}[$__rate_interval])withRangequery type, Minimum step 40m and time range 31h. (rate_interval in bracket should be 9600s) - Run
rate(ALERTS{alertstate="firing"}[$__range])withRangequery 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"}withInstantquery type AND{event="add"}withInstantquery type