PCA (Prometheus Certified Associate) sample exam question with answer 113

Question:
Which of the following queries can be used to provide all values of the up metric over the last five minutes?

  1. SELECT up WHERE timestamp <= now – 300
  2. up-5m
  3. up offset 5m
  4. up[5m]
Answer:
D - correct one. Check range vector selectors
A - this query is written using SQL. Prometheus queries are written using PromQL which uses an entirely different syntax.
B - this query is not valid PromQL
C - this query gives the value of the up metric five minutes ago. It does not give all of the samples of the up metric between now and five minutes ago as desired