How many metric types does Prometheus text format support?
Prometheus defines four core metric types in its official exposition format, which are: Counter, Gauge, Histogram, and Summary. These types represent the fundamental building blocks for expressing quantitative measurements of system performance, behavior, and state.
A Counter is a cumulative metric that only increases (e.g., number of requests served).
A Gauge represents a value that can go up and down, such as memory usage or temperature.
A Histogram samples observations (e.g., request durations) and counts them in configurable buckets, providing both counts and sum of observed values.
A Summary is similar to a histogram but provides quantile estimation over a sliding time window along with count and sum metrics.
These four types are the only officially supported metric types in the Prometheus text exposition format as defined by the Prometheus data model. Any additional metrics or custom naming conventions are built on top of these core types but do not constitute new types.
Extracted and verified from Prometheus official documentation sections on Metric Types and Exposition Formats in the Prometheus study materials.
How do you calculate the average request duration during the last 5 minutes from a histogram or summary called http_request_duration_seconds?
In Prometheus, histograms and summaries expose metrics with _sum and _count suffixes to represent total accumulated values and sample counts, respectively. To compute the average request duration over a given time window (for example, 5 minutes), you divide the rate of increase of _sum by the rate of increase of _count:
\text{Average duration} = \frac{\text{rate(http_request_duration_seconds_sum[5m])}}{\text{rate(http_request_duration_seconds_count[5m])}}
Here,
http_request_duration_seconds_sum represents the total accumulated request time, and
http_request_duration_seconds_count represents the number of requests observed.
By dividing these rates, you obtain the average request duration per request over the specified time range.
Extracted and verified from Prometheus documentation -- Querying Histograms and Summaries, PromQL Rate Function, and Metric Naming Conventions sections.
If the vector selector foo[5m] contains 1 1 NaN, what would max_over_time(foo[5m]) return?
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.
When can you use the Grafana Heatmap panel?
The Grafana Heatmap panel is best suited for visualizing histogram metrics collected from Prometheus. Histograms provide bucketed data distributions (e.g., request durations, response sizes), and the heatmap effectively displays these as a two-dimensional density chart over time.
In Prometheus, histogram metrics are exposed as multiple time series with the _bucket suffix and the label le (less than or equal). Grafana interprets these buckets to create visual bands showing how frequently different value ranges occurred.
Counters, gauges, and info metrics do not have bucketed distributions, so a heatmap would not produce meaningful output for them.
Verified from Grafana documentation -- Heatmap Panel Overview, Visualizing Prometheus Histograms, and Prometheus documentation -- Understanding Histogram Buckets.
What Prometheus component would you use if targets are running behind a Firewall/NAT?
When Prometheus targets are behind firewalls or NAT and cannot be reached directly by the Prometheus server's pull mechanism, the recommended component to use is PushProx.
PushProx works by reversing the usual pull model. It consists of a PushProx Proxy (accessible by Prometheus) and PushProx Clients (running alongside the targets). The clients establish outbound connections to the proxy, which allows Prometheus to ''pull'' metrics indirectly. This approach bypasses network restrictions without compromising the Prometheus data model.
Unlike the Pushgateway (which is used for short-lived batch jobs, not network-isolated targets), PushProx maintains the Prometheus ''pull'' semantics while accommodating environments where direct scraping is impossible.
Verified from Prometheus documentation and official PushProx design notes -- Monitoring Behind NAT/Firewall, PushProx Overview, and Architecture and Usage Scenarios sections.
Christopher Robinson
7 days agoAmy Bailey
8 days agoMonica Mitchell
1 month agoDonald Moore
1 month agoJeffrey Allen
2 months agoJoshua Jones
2 months agoPaul Peterson
3 months agoAshley Thomas
3 months agoElizabeth Lee
3 months agoKevin Sanchez
3 months agoJeffrey Moore
3 months agoJoseph Wright
3 months agoChristopher Brown
3 months agoBurma
4 months agoWynell
4 months agoJohnetta
5 months agoJudy
5 months agoAlysa
5 months agoCatalina
5 months agoMose
6 months agoLelia
6 months agoAlaine
6 months agoAmie
6 months agoCasey
7 months agoBelen
7 months agoElsa
7 months agoDortha
7 months agoJohnson
8 months agoAaron
8 months agoLenna
8 months agoElina
8 months agoYvonne
9 months agoSantos
9 months agoDaniela
9 months agoMiles
9 months agoCarlee
10 months agoTamesha
10 months ago