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

Question:
Let cert_expiry be a gauge metric whose value is a Unix timestamp (epoch time) representing the time a given certificate will expire.
Which of the following queries gives the time in seconds until certificate expiration?

  1. cert_expiry{unit="seconds"}
  2. cert_expiry
  3. cert_expiry – time()
  4. cert_expiry - time("s")
Answer:
C - is the correct answer. More about time
A - is incorrect as there was no mention of a unit label associated with the cert_expiry metric. Thus, this query would not return any results
B - is incorrect as this query gives the Unix timestamp that each certificate will expire, not the time until it does
D - is incorrect as the time function does not accept any arguments