PCA PCA Exporters & Instrumentation 2 — Questions and Answers
Question 1: What is the Prometheus exposition format, and which content type does it use?
- A text-based line format exposed over HTTP with Content-Type: text/plain; version=0.0.4 (Correct answer)
- A binary Protocol Buffers format with Content-Type: application/protobuf
- A JSON format with Content-Type: application/json; schema=prometheus
- An OpenMetrics format with Content-Type: application/openmetrics+json
Correct answer: A text-based line format exposed over HTTP with Content-Type: text/plain; version=0.0.4
Prometheus's native exposition format is a human-readable text format served over HTTP with the text/plain content type.
Question 2: What does the `_total` suffix in a Prometheus metric name conventionally indicate?
- The metric is a Counter that only increases over time (Correct answer)
- The metric represents a sum across all labels
- The metric is a Histogram's bucket total
- The metric aggregates multiple gauges into one total
Correct answer: The metric is a Counter that only increases over time
By convention, counter metrics are suffixed with _total to signal they are monotonically increasing cumulative counts.
Question 3: When instrumenting a web server with Prometheus, which metric type should track the total number of HTTP requests served?
- Counter (Correct answer)
- Gauge
- Summary
- Histogram
Correct answer: Counter
HTTP requests are a monotonically increasing count, so a Counter is the correct type; you can then use rate() to compute requests per second.
Question 4: What is the purpose of the `HELP` line in the Prometheus text exposition format?
- It provides a human-readable description of the metric for documentation and UI display (Correct answer)
- It specifies the scrape help endpoint path for Prometheus to find the metric
- It defines the data type of the metric (counter, gauge, etc.)
- It lists the valid label keys allowed for the metric
Correct answer: It provides a human-readable description of the metric for documentation and UI display
The HELP comment line gives a textual description of what the metric measures, shown in the Prometheus UI and documentation tools.
Question 5: Which exporter is commonly used to expose PostgreSQL database metrics to Prometheus?
- postgres_exporter (Correct answer)
- pg_prometheus
- db_exporter
- sql_exporter
Correct answer: postgres_exporter
The postgres_exporter (writerside/postgres_exporter) connects to PostgreSQL and exposes database statistics like connections, query counts, and replication lag.
Question 6: What does the Prometheus Pushgateway allow you to do?
- Push metrics from short-lived jobs to an intermediary that Prometheus can scrape (Correct answer)
- Push alert notifications from Prometheus to Alertmanager
- Push TSDB blocks to remote object storage
- Push configuration changes to Prometheus without a restart
Correct answer: Push metrics from short-lived jobs to an intermediary that Prometheus can scrape
The Pushgateway accepts metrics pushed from batch jobs or crons that exit before Prometheus can scrape them, holding the last pushed value until overwritten.
What is the Prometheus exposition format, and which content type does it use?