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

Question:
Let cert_expiry be a gauge metric whose value is a Unix timestamp (epoch time) representing the time a given certificate will expire.
When used as an expression in an alerting rule, which of the following expressions would alert seven days prior to the expiration of each certificate?

  1. cert_expiry - time() < 7 * 86400
  2. cert_expiry{unit="d"} - time("d") > 7
  3. cert_expiry - time() < 7
  4. cert_expiry - time() > 7 * 86400
Answer:
A - is the correct answer
B - is the incorrect as there was no mention of a unit label associated with the cert_expiry metric so the query would return no results. Additionally, the time function does not accept any arguments
C - is incorrect as this query expression would generate an alert when each certificate was within seven seconds of expiring, not seven days
D - is incorrect as this query expression would generate an alert when each certificate had more than seven days before it expired, not less