Prometheus query

The power of Prometheus is its query language, through which we can use expressions, aggregations, and so on to collect data from data, which can then be used by different graphing tools such as Kibana to show valuable derived data.

In the Expression input box at the top of the web page, enter istio_requests_total . Then, click the Execute button.

Let's try out some different queries:

  1. Let's get the total count of all the requests to the productpage service: 
istio_requests_total{destination_service="productpage.istio-lab.svc.cluster.local"}

The preceding Prometheus query language expression gives us the total request count, as shown in the following screenshot:

  1. To get the total count of all requests to v2 of the reviews service, use the following code: 
istio_requests_total{destination_service="reviews.istio-lab.svc.cluster.local", destination_version="v2"}
  1. To get the rate of requests over the past 5 minutes to all the instances of the productpage service, use the following code:
rate(istio_requests_total{destination_service=~"productpage.*", response_code="200"}[5m])

The preceding query expression builds the rate of requests over a period of 5 minutes, as shown in the following screenshot:

Here, we have seen that it is possible to build any custom data preparation from raw data so that it can be used in a dashboard. Grafana's dashboard in Istio can display time-series data and the aggregations that have been derived from the data.

Next, we will explore the state of Prometheus data collection and the list of targets that it collects data from.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.63.136