Guidance to set up metrics for a service using istio

10/19/2019

I was wondering if anyone could point me to a good source for getting a service using istio to report basic metrics. I would assume that simple things like response successes (200), errors (503,404, etc), transaction time would be automatically wired up but I am guessing I am missing something.

I have used things like collectd and statsd to aggregate metrics in the past but was expecting some basic things to be wired up automatically.

I plan to play with the bookinfo app soon to see if perhaps this answers my questionsL https://istio.io/docs/examples/bookinfo/

-- runamok
istio
kubernetes
prometheus

1 Answer

10/21/2019

If you plan to setup the Bookinfo sample application then I would recommend sticking to istio documentation.

If you go into ISTIO / DOCS / TASKS / TELEMETRY / METRICS / COLLECTING METRICS it will explain how to setup basic metrics collection via the Prometheus UI using Mixer functionality.

The metrics configuration directs Mixer to send metric values to Prometheus. It uses three stanzas (or blocks) of configuration: instance configuration, handler configuration, and rule configuration.

The kind: instance stanza of configuration defines a schema for generated metric values (or instances) for a new metric named doublerequestcount. This instance configuration tells Mixer how to generate metric values for any given request, based on the attributes reported by Envoy (and generated by Mixer itself).

The kind: handler stanza of configuration defines a handler named doublehandler. The handler spec configures how the Prometheus adapter code translates received metric instances into Prometheus-formatted values that can be processed by a Prometheus backend. This configuration specified a new Prometheus metric named double_request_count. The Prometheus adapter prepends the istio_ namespace to all metric names, therefore this metric will show up in Prometheus as istio_double_request_count. The metric has three labels matching the dimensions configured for doublerequestcount instances.

The kind: rule stanza of configuration defines a new rule named doubleprom. The rule directs Mixer to send all doublerequestcount instances to the doublehandler handler. Because there is no match clause in the rule, and because the rule is in the configured default configuration namespace (istio-system), the rule is executed for all requests in the mesh.

Also you can read and setup Querying Metrics from Prometheus using Prometheus add-on:

Mixer comes with a built-in Prometheus adapter that exposes an endpoint serving generated metric values. The Prometheus add-on is a Prometheus server that comes preconfigured to scrape Mixer endpoints to collect the exposed metrics. It provides a mechanism for persistent storage and querying of Istio metrics.

-- Crou
Source: StackOverflow