Size: 1585
Comment:
|
Size: 775
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 26: | Line 26: |
== PromQL == | == Installation == |
Line 28: | Line 28: |
'''PromQL''' is a query language built for the Prometheus project. It specializes in time series queries. | ---- |
Line 30: | Line 30: |
Consider the use case of monitoring 5xx errors in an [[NGINX]] instance. The below would query all such events: | |
Line 32: | Line 31: |
{{{ http_requests_total{status="500"} }}} |
|
Line 36: | Line 32: |
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: | == Configuration == |
Line 38: | Line 34: |
{{{ rate(http_requests_total{status="500"}[5m]) }}} |
---- |
Line 42: | Line 36: |
Queries can be functionally combined as shown below, to compute the error rate: | |
Line 44: | Line 37: |
{{{ sum(rate(http_requests_total{status="500"}[5m])) / sum(rate(http_requests_total{}[5m])) }}} |
|
Line 49: | Line 38: |
Furthermore, operators such as division (`/`) are capable of matching left-hand and right-hand vectors, to compute the per-path error rate: | == Usage == |
Line 51: | Line 40: |
{{{ 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.
Contents
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
Installation
Configuration
Usage
See PromQL for the query language.