PCA (Prometheus Certified Associate) sample exam question with answer 612
Question:
Which of the following PromQL expressions can be used to calculate the percentage of time a metric was above a certain threshold over a specified time range?
- avg_over_time(metric_name > threshold[5m]) * 100
- count_over_time(metric_name > threshold[5m]) / count_over_time(metric_name)[5m] * 100
- sum_over_time(metric_name > threshold[5m]) / sum_over_time(metric_name)[5m] * 100
- quantile_over_time(0.99, metric_name > threshold[5m]) * 100
Answer:
B - is the correct answer. To calculate the percentage of time a metric was above a certain threshold, we need to divide the count of time intervals in which the metric exceeded the threshold by the total count of time intervals in the range