PCA practice question 8 of 15
Which of the following is an invalid @ modifier expression?
Full set: 60 questionsThe @ modifier in PromQL is used to change the evaluation time for an expression. When used with aggregation operators such as sum(), the canonical and syntactically correct method is to apply the modifier to the entire aggregation expression. The expression sum(httprequeststotal{method="GET"}) @ 1609746000 correctly evaluates the sum() function as if the current time were the specified timestamp. The syntax in option D, sum(httprequeststotal{method="GET"} @ 1609746000), which places the @ modifier on the instant vector selector inside the aggregation function, is not the standard syntax for this operation and is considered invalid.
A. This is a valid expression. The start() function is used with the @ modifier to evaluate the expression at the start time of a range query.
B. This is the correct and valid syntax for evaluating an aggregation at a specific Unix timestamp. The @ modifier is correctly applied to the entire sum() expression.
C. This is a valid expression. The end() function is used with the @ modifier to evaluate the expression at the end time of a range query.
1. Prometheus Official Documentation, "Querying > Basics", @ modifier section. This section outlines the primary uses of the @ modifier. It can be applied to an instant vector selector (metric @ timestamp) or to a full expression. For aggregations, the standard is to apply it to the entire expression to set the evaluation time for the whole operation, as shown in option B. The syntax in option D is non-canonical for aggregations.
Source: https://prometheus.io/docs/prometheus/latest/querying/basics/#modifier
2. Prometheus Official Documentation, "Querying > Operators", "Aggregation operators" section. The syntax for aggregation operators is defined as aggr-op([parameter,] ). This implies that modifiers which affect the evaluation time of the entire operation, like @, should be applied to the complete aggr-op(...) construct, not to the argument within it.
Source: https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators
Keep practicing
Take the free PCA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PCA practice questions
- Question 1What function calculates the tp-quantile from a histogram?
- Question 2How can you select all the up metrics whose instance label matches the regex fe-.*?
- Question 3Which exporter would be best suited for basic HTTP probing?
- Question 4What Prometheus component would you use if targets are running behind a Firewall/NAT?
- Question 5What is the name of the official *nix OS kernel metrics exporter?
- Question 6Which function would you use to calculate the 95th percentile latency from histogram data?
