Given the following Histogram metric data, how many requests took less than or equal to 0.1 seconds?apiserver_request_duration_seconds_bucket{job="kube-apiserver", le="+Inf"} 3apiserver_request_duration_seconds_bucket{job="kube-apiserver", le="0.05"} 0apiserver_request_duration_seconds_bucket{job="kube-apiserver", le="0.1"} 1apiserver_request_duration_seconds_bucket{job="kube-apiserver", le="1"} 3apiserver_request_duration_seconds_count{job="kube-apiserver"} 3apiserver_request_duration_seconds_sum{job="kube-apiserver"} 0.554003785
Answer(s): C
In Prometheus, histogram metrics use cumulative buckets to record the count of observations that fall within specific duration thresholds. Each bucket has a label le ("less than or equal to"), representing the upper bound of that bucket.In the given metric, the bucket labeled le="0.1" has a value of 1, meaning exactly one request took less than or equal to 0.1 seconds. Buckets are cumulative, so:le="0.05" 0 requests 0.05 seconds le="0.1" 1 request 0.1 seconds le="1" 3 requests 1 second le="+Inf" all 3 requests totalThe _sum and _count values represent total duration and request count respectively, but the number of requests below a given threshold is read directly from the bucket's le value.
Verified from Prometheus documentation Understanding Histograms and Summaries, Bucket Semantics, and Histogram Query Examples sections.
Which kind of metrics are associated with the function deriv()?
Answer(s): B
The deriv() function in PromQL calculates the per-second derivative of a time series using linear regression over the provided time range. It estimates the instantaneous rate of change for metrics that can both increase and decrease -- which are typically gauges.Because counters can only increase (except when reset), rate() or increase() functions are more appropriate for them. deriv() is used to identify trends in fluctuating metrics like CPU temperature, memory utilization, or queue depth, where values rise and fall continuously.In contrast, summaries and histograms consist of multiple sub-metrics (e.g., _count, _sum, _bucket) and are not directly suited for derivative calculation without decomposition.
Extracted and verified from Prometheus documentation PromQL Functions deriv(), Understanding Rates and Derivatives, and Gauge Metric Examples.
Which metric type uses the delta() function?
The delta() function in PromQL calculates the difference between the first and last samples in a range vector over a specified time window. This function is primarily used with gauge metrics, as they can move both up and down, and delta() captures that net change directly.For example, if a gauge metric like node_memory_Active_bytes changes from 1000 to 1200 within a 5-minute window, delta(node_memory_Active_bytes[5m]) returns 200.Unlike rate() or increase(), which are designed for monotonically increasing counters, delta() is ideal for metrics representing resource levels, capacities, or instantaneous measurements that fluctuate over time.
Verified from Prometheus documentation PromQL Range Functions delta(), Gauge Semantics and Usage, and Comparing delta() and rate() sections.
With the following metrics over the last 5 minutes:up{instance="localhost"} 1 1 1 1 1up{instance="server1"} 1 0 0 0 0What does the following query return:min_over_time(up[5m])
Answer(s): A
The min_over_time() function in PromQL returns the minimum sample value observed within the specified time range for each time series.In the given data:For up{instance="localhost"}, all samples are 1. The minimum value over 5 minutes is therefore 1.For up{instance="server1"}, the sequence is 1 0 0 0 0. The minimum observed value is 0.Thus, the query min_over_time(up[5m]) returns two series -- one per instance:{instance="localhost"} 1{instance="server1"} 0This query is commonly used to check uptime consistency. If the minimum value over the time window is 0, it indicates at least one scrape failure (target down).
Verified from Prometheus documentation PromQL Range Vector Functions, min_over_time() definition, and up Metric Semantics sections.
Which of the following PromQL queries is invalid?
The max operator in PromQL is an aggregation operator, not a binary vector matching operator. Therefore, the valid syntax for aggregation uses by() or without(), not on().max by (instance) up Valid; aggregates maximum values per instance.max without (instance) up and max without (instance, job) up Valid; aggregates over all labels except those listed.max on (instance) (up) Invalid; the keyword on() is only valid in binary operations (e.g., +, -, and, or, unless), where two vectors are being matched on specific labels.Hence, max on (instance) (up) is a syntax error in PromQL because on() cannot be used directly with aggregation operators.
Verified from Prometheus documentation Aggregation Operators, Vector Matching on()/ignoring(), and PromQL Language Syntax Reference sections.
Post your Comments and Discuss Linux Foundation PCA exam prep with other Community members:
Our website is free, but we have to fight against AI bots and content theft. We're sorry for the inconvenience caused by these security measures. You can access the rest of the PCA content, but please register or login to continue.