PromQL basics
With all this talk of how data gets into Prometheus’s database and how it’s stored there, I reckon it’s about time we look at how we get that data out and make use of it. To do this, Prometheus has its own query language: PromQL.
PromQL is a vast topic, and you can craft some cool queries with it, especially concerning alerting (covered in Chapter 5).
Note
Most PromQL queries provided as examples will work in your Prometheus environment from Chapter 2!
Feel free to tweak them and experiment with them as you go along by using kubectl port-forward svc/mastering-prometheus-kube-prometheus 9090
and opening http://localhost:9090
in your browser to connect to Prometheus.
Syntax overview
PromQL is pretty straightforward and does not have a litany of different data types you need to concern yourself with. The matching operators for label filters are intuitive, and there are only four possible types that PromQL expressions can be evaluated...