Skip to content

Instantly share code, notes, and snippets.

@ivanahuckova
Last active October 22, 2022 13:28
Show Gist options
  • Save ivanahuckova/e717457b32265f1b4e0583f0861cbb27 to your computer and use it in GitHub Desktop.
Save ivanahuckova/e717457b32265f1b4e0583f0861cbb27 to your computer and use it in GitHub Desktop.

Prometheus backend migrations manual tests

These tests are related to this Epic: grafana/grafana#37784

Prerequisites

  • 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

Explore

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.

One query

Just compare table & graph results:

  1. Run ALERTS{alertstate="firing"} with Instant query type.
  2. Run ALERTS{alertstate="firing"} with Range query type.
  3. Run ALERTS{alertstate="firing"} with Both query type.

Two queries

Just compare table & graph results. Don't forget to have both queries without exemplars when testing backend:

  1. Run ALERTS{alertstate="firing"} with Instant query type AND {event="add"} with Instant query type.
  2. Run ALERTS{alertstate="firing"} with Instant query type AND {event="add"} with Range query type.
  3. Run ALERTS{alertstate="firing"} with Instant query type AND {event="add"} with Both query type.
  4. Run ALERTS{alertstate="firing"} with Range query type AND {event="add"} with Instant query type.
  5. Run ALERTS{alertstate="firing"} with Range query type AND {event="add"} with Range query type.
  6. Run ALERTS{alertstate="firing"} with Range query type AND {event="add"} with Both query type.
  7. Run ALERTS{alertstate="firing"} with Both query type AND {event="add"} with Instant query type.
  8. Run ALERTS{alertstate="firing"} with Both query type AND {event="add"} with Range query type.
  9. Run ALERTS{alertstate="firing"} with Both query type AND {event="add"} with Both query type.

Templating

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.

  1. Run rate(ALERTS{alertstate="firing"}[$__interval]) with Range query type, Minimum step 40m and time range 1h. (interval should be 2400s)
  2. Run rate(ALERTS{alertstate="firing"}[$__interval]) with Range query type, Maximum step 5s and time range 1h. (interval should be 5s)
  3. Run rate(ALERTS{alertstate="firing"}[$__interval]) with Range query type, Minimum step 40m and time range 30d. (interval should be 3600s or 1h)
  4. Run rate(ALERTS{alertstate="firing"}[$__interval]) with Range query type, Maximum step 40m and time range 30d. (interval should be 2400s)
  5. Run rate(ALERTS{alertstate="firing"}[$__rate_interval]) with Range query type, Minimum step 40m and time range 31h. (rate_interval in bracket should be 9600s)
  6. Run rate(ALERTS{alertstate="firing"}[$__range]) with Range query type, Maximum step 40m and time range 1h (range in bracket should be 3600s)

Hiding

Hide 1 query. Then hide the other query. And lastly hide both.

  1. Run ALERTS{alertstate="firing"} with Instant query type AND {event="add"} with Instant query type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment