Differences between revisions 1 and 2
Revision 1 as of 2021-11-17 19:44:07
Size: 1585
Comment:
Revision 2 as of 2022-05-21 16:38:53
Size: 706
Comment:
Deletions are marked like this. Additions are marked like this.
Line 26: Line 26:
== PromQL == == Usage ==
Line 28: Line 28:
'''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]))
}}}
See [[Prometheus/PromQL|PromQL]] for the query language.

Prometheus

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


Project

The Prometheus project consists of:

  • the Prometheus time series database
  • the Prometheus web scraper which aggregates metrics from targets into the database

  • the built-in web interface for querying the database
  • the HTTP API for querying the database, as used by Grafana
  • a set of exporters which expose metrics from various sources

  • the Prometheus query language, PromQL


Usage

See PromQL for the query language.


CategoryRicottone

Prometheus (last edited 2023-04-08 13:53:42 by DominicRicottone)