Prometheus

Prometheus is a free and open source software project centered on server monitoring and alerting.


Project

The Prometheus project consists of:


PromQL

PromQL is a query language built for the Prometheus project. It specializes in time series queries.

Consider the use case of monitoring 5xx errors in an NGINX instance. The below would query all such events:

http_requests_total{status="500"}

The below would then query the per-second rate of those events over 5 minutes, demonstrating how time series are a first class citizen of this language:

rate(http_requests_total{status="500"}[5m])

Queries can be functionally combined as shown below, to compute the error rate:

  sum(rate(http_requests_total{status="500"}[5m]))
/ sum(rate(http_requests_total{}[5m]))

Furthermore, operators such as division (/) are capable of matching left-hand and right-hand vectors, to compute the per-path error rate:

  sum by(path) (rate(http_requests_total{status="500"}[5m]))
/ sum by(path) (rate(http_requests_total{}[5m]))


CategoryRicottone