What is PromQL, and what is an instant vector versus a range vector? [Basic]
Answer
PromQL is Prometheus's query language. An instant vector is a set of time series at one evaluation timestamp; a range vector is a set of time series with samples over a time window such as 5 minutes.
Technical explanation
Instant vectors are used for current values, aggregations, and alert expressions at a point in time.
Range vectors are required by functions such as rate(), increase(), avg_over_time(), max_over_time(), and histogram calculations.
Understanding vector types prevents common errors such as applying sum directly to a range vector.
Hands-on example
Examples: http_requests_total is an instant vector. http_requests_total[5m] is a range vector. rate(http_requests_total[5m]) converts the range vector into an instant vector of per-second rates, which can then be aggregated with sum by (service).
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Observability interview questions
- What is the Pushgateway, and why is it discouraged for most cases? [Basic]
- What is the difference between an exporter and instrumenting your app directly? [Basic]
- What is the difference between rate() and irate()? [Basic]
- How do you compute a 95th percentile latency from a histogram in PromQL (histogram_quantile)? [Basic]
- What is a scrape target, and how does service discovery find them? [Basic]
- How does Prometheus collect metrics — what is the pull model and scraping? [Basic]
- What is a recording rule, and when would you use one? [Basic]
- What is an alerting rule, and how does it differ from a recording rule? [Basic]