Interview Observability

What is a recording rule, and when would you use one? [Basic]

Answer

A recording rule precomputes and stores the result of a PromQL expression as a new time series. I use recording rules for expensive, frequently used, or standardized queries such as service:error_ratio:rate5m.

Technical explanation

Recording rules improve dashboard performance and make alert expressions simpler and more consistent.

They are evaluated on a schedule by Prometheus and stored like normal metrics.

Naming should be consistent and indicate level, metric, operation, and window.

Hands-on example

Example rule:

groups:

- name: service-slo

rules:

- record: service:http_error_ratio:rate5m

expr: sum(rate(http_requests_total{status=~'5..'}[5m])) by (service) / sum(rate(http_requests_total[5m])) by (service)

Then alerts and dashboards reuse service:http_error_ratio:rate5m.

Preparing for an interview?

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

← All Observability questions