Telemetry of Metrics using Prometheus
Last updated
Last updated
Infrastructure backends are designed to provide support functionality such as telemetry capturing systems. These services traditionally directly integrate with the backend systems, creating a hard coupling. Istio provides a flexible model to collect telemetry for the services in a mesh. Mixer is the Istio component responsible for providing the telemetry collection.
The Envoy sidecar (proxy) logically calls Mixer before each request to perform precondition checks, and after each request to report telemetry. The sidecar has local caching such that a large percentage of precondition checks can be performed from cache. Additionally, the sidecar buffers outgoing telemetry such that it only calls Mixer infrequently.
You can find a list of Mixer adapters at https://istio.io/docs/reference/config/policy-and-telemetry/adapters/. Mixer templates are used to send data to individual adapters.
Mixer is in essence an attribute processing machine. An attribute
is a small bit of data that describes a single property of a specific service request or the environment for the request. Each attribute has a name and a type. The Envoy is the main producer of attributes in Istio. Here is a list of common attributes in Istio: https://istio.io/docs/reference/config/policy-and-telemetry/attribute-vocabulary/.
An Instance configuration is used to map request attributes to adapter inputs for a handler. Rules specify when a particular handler is invoked with a specific instance configuration.
In the following part, you will add configuration with three pieces of the Mixer functionality to collect metrics:
Generation of an instance
from Istio attributes,
Creation of a handler
(a configured Mixer adapter) for processing generated instances,
A rule
to dispatch instances to handlers,
Review the file samples/bookinfo/telemetry/metrics.yaml
,
The metrics specification adds an instance configuration, a handler for the instance input and a rule to map the input from the instance to the handler,
This will display the following metric in Prometheus:
Apply the metrics specification,
Make sure that a Prometheus deployment is running,
Next you can send requests to your Bookinfo application and see the integration with Prometheus,
If you need the external IP address again for the ingress Gateway, use the following command,
Setup port-forwarding for Prometheus to your localhost,
Open Prometheus in a browser on your localhost via http://localhost:9090/graph?g0.range_input=1h&g0.expr=istio_double_request_count&g0.tab=1,
Send requests to the Bookinfo application, which will show up immediately in the Prometheus dashboard,