PCA Metric Collection & Data Modeling 2 — Questions and Answers
Question 1: Which Prometheus metric type is best suited for tracking the number of currently active HTTP connections?
- Counter
- Gauge (Correct answer)
- Histogram
- Summary
Correct answer: Gauge
Gauges represent values that can go up or down, making them ideal for measuring currently active connections.
Question 2: In Prometheus, what does the `le` label represent in a histogram metric?
- Label encoding
- Less than or equal to bucket boundary (Correct answer)
- Log exponent
- Label expression
Correct answer: Less than or equal to bucket boundary
The `le` label in histograms denotes the upper inclusive bound ('less than or equal to') for each bucket.
Question 3: A Prometheus scrape target returns a metric with timestamp older than the staleness window. What happens?
- Prometheus stores the stale sample with a special NaN value (Correct answer)
- Prometheus rejects the metric entirely
- Prometheus uses the previous value
- Prometheus resets the metric to zero
Correct answer: Prometheus stores the stale sample with a special NaN value
Prometheus marks stale samples with a special staleness NaN marker to signal that the time series is no longer active.
Question 4: Which exposition format does Prometheus use by default when scraping targets?
- JSON
- Protobuf
- OpenMetrics text format
- Plain text exposition format (Correct answer)
Correct answer: Plain text exposition format
Prometheus defaults to the plain text exposition format (version 0.0.4) when scraping targets.
Question 5: What is the purpose of the `_total` suffix convention in Prometheus counter metrics?
- It marks a metric as cumulative
- It indicates the metric is a histogram total
- It is required by the OpenMetrics specification for counters (Correct answer)
- It signals that the counter resets periodically
Correct answer: It is required by the OpenMetrics specification for counters
The OpenMetrics specification requires counters to use the `_total` suffix to clearly indicate they are monotonically increasing totals.
Question 6: How does Prometheus handle a counter reset (e.g., after a process restart) when using `rate()`?
- It returns NaN for the affected interval
- It automatically detects the reset and adjusts the calculation (Correct answer)
- It requires a manual annotation in the metric
- It returns a negative rate
Correct answer: It automatically detects the reset and adjusts the calculation
`rate()` automatically detects counter resets by checking for decreases in value and corrects the calculation accordingly.
Question 7: Which label naming practice should be avoided in Prometheus to prevent high cardinality issues?
- Using static labels like `environment` or `region`
- Using user IDs or email addresses as label values (Correct answer)
- Using the `job` label to identify a service
- Using `instance` to identify individual targets
Correct answer: Using user IDs or email addresses as label values
Using unbounded values like user IDs or email addresses as label values creates extremely high cardinality, degrading Prometheus performance.
Which Prometheus metric type is best suited for tracking the number of currently active HTTP connections?