Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Linux Foundation PCA Exam - Topic 2 Question 16 Discussion

If the vector selector foo[5m] contains 1 1 NaN, what would max_over_time(foo[5m]) return?
B) 1
A) It errors out.
C) NaN
D) No answer.

Linux Foundation PCA Exam - Topic 2 Question 16 Discussion

Actual exam question for Linux Foundation's PCA exam
Question #: 16
Topic #: 2
[All PCA Questions]

If the vector selector foo[5m] contains 1 1 NaN, what would max_over_time(foo[5m]) return?

Show Suggested Answer Hide Answer
Suggested Answer: B

In PromQL, range vector functions like max_over_time() compute an aggregate value (in this case, the maximum) over all samples within a specified time range. The function ignores NaN (Not-a-Number) values when computing the result.

Given the range vector foo[5m] containing samples [1, 1, NaN], the maximum value among the valid numeric samples is 1. Therefore, max_over_time(foo[5m]) returns 1.

Prometheus functions handle missing or invalid data points gracefully---ignoring NaN ensures stable calculations even when intermittent collection issues or resets occur. The function only errors if the selector is syntactically invalid or if no numeric samples exist at all.


Verified from Prometheus documentation -- PromQL Range Vector Functions, Aggregation Over Time Functions, and Handling NaN Values in PromQL sections.

Contribute your Thoughts:

0/2000 characters
Janine
2 days ago
Wait, does it really return 1? That seems odd.
upvoted 0 times
...
An
8 days ago
A max function should ignore NaN, right?
upvoted 0 times
...
Natalie
13 days ago
Definitely C, NaN is in there.
upvoted 0 times
...
Sharmaine
18 days ago
I think it returns 1.
upvoted 0 times
...
Emmanuel
23 days ago
I feel like the answer could be NaN since it's in the vector, but I also recall that max functions might ignore NaN values.
upvoted 0 times
...
Nenita
28 days ago
I practiced a similar question, and I think NaN can sometimes cause errors, but I'm not confident if that's the case here.
upvoted 0 times
...
Gail
1 month ago
I think max_over_time should return the maximum value, which in this case would be 1, but I'm a bit confused about how NaN interacts with that.
upvoted 0 times
...
Elke
1 month ago
I remember something about how NaN values are handled in calculations, but I'm not entirely sure if they would affect the max_over_time function.
upvoted 0 times
...

Save Cancel