Comparing k6 test results from prometheus datasource

  • What Grafana version and what operating system are you using?
    Grafana Version: 10.0.3 on docker
    OS: Endeavouros

  • What are you trying to achieve?
    I am trying to compare the test results from 2 different k6 load tests on the same graph. I want to show the difference between the response time on the 2 runs visually

  • How are you trying to achieve it?
    I used this guide to visualize k6 load test results in grafana on the official k6 dashboard.

    I created 2 grafana variables that can be any of the testids of the k6 run. I then tried to create a panel that makes 2 separate queries based on the variables and was hoping to dynamically offset the result of one of the queries so that they start from the same time. This is the part I got stuck in as I am unable to calculate the necessary offset using promQL, although manually setting the offset seems to give me the desired outcome.

    I also need to ensure that both queries use the same scale so that the comparison is fair.

To summarize my questions:

  1. How do I dynamically calculate offsets in promQL
  2. How do I make two different queries use the same scale on the y-axis

Any help regarding both these matters will be greatly appreciated.

PS: If someone has a better way to complete the use case I mentioned I am completely open to those solution.