Prometheus - Query (PromQL, Expression)

Scale Counter Graph

About

PromQL Query / Expression

Example

Total request over a period of time

The number of request increase every 5 minutes

sum(increase(prometheus_http_requests_total[5m]))

Time Series

  • return the time series of the metric name promhttp_metric_handler_requests_total with different labels by requests statuses.
promhttp_metric_handler_requests_total 

Filtering

  • requests that resulted in HTTP code 200
promhttp_metric_handler_requests_total{code="200"} 

Count

  • Number of times serie data by metrics
count(promhttp_metric_handler_requests_total) 

Request Rate

-- the per-second HTTP request rate returning status code 200
rate(promhttp_metric_handler_requests_total{code="200"}[1m]) 
-- Given an HTTP request counter, this query calculates the per-second average request rate over the last 5 minutes.
rate(http_request_total[5m]) 

Histogram

  • 95th Percentile of Request Latencies: Calculates the 95th percentile of HTTP request rate over 5 minute windows.
histogram_quantile(0.95, sum(rate(prometheus_http_request_duration_seconds_bucket[5m])) by (le))

Total Alerts fired over the last 24 hours

Alerts Firing: Sums up the alerts that have been firing over the last 24 hours.

sort_desc(sum(sum_over_time(ALERTS{alertstate="firing"}[24h])) by (alertname))

Management

GUI

Step

Defines the graph resolution using a duration format (15s, 1m, 3h, …). Small steps create high-resolution graphs but can be slow over larger time ranges. Using a longer step lowers the resolution and smooths the graph by producing fewer datapoints. If no step is given the resolution is calculated automatically.

Documentation / Reference





Discover More
Scale Counter Graph
Prometheus - Alert

alert in prometheus Alerts Firing: Sums up the alerts that have been firing over the last 24 hours.
Scale Counter Graph
Prometheus - Label (Dimension)

A label in Prometheus is specified in a metric and allows dimensional data model Any given combination of labels for the same metric name identifies a particular dimensional instantiation of that metric...
Scale Counter Graph
Prometheus - OS PromQl Expression

This page is the calculation of OS metrics with promql This metrics are collected and send to the server on linux by the node_exporter. The average amount of CPU time spent in system mode, per second,...
Scale Counter Graph
Prometheus - Server

The Prometheus server is the server of the monitoring prometheus system The server is: a time series database that can be queried with promql a collector that scrap the metrics from exporter. ...
Scale Counter Graph
Prometheus - Time Serie

All data stored and manipulated are time series in Prometheus server making it a time serie database. Every time series is uniquely identified by: its metric name and optional key-value pairs called...



Share this page:
Follow us:
Task Runner