Main => Create a metrics adapter
In this exercise we will follow the Istio guide to creating a metrics adapter. There are many in process Istio adapters; you can view the complete list here. Yours truly wrote the first 3rd party adapter - the Circonus.com metrics adapter.
There are two types of adapters - in process, and gRPC based. The Istio developers are encouraging adapter developers to move to the gRPC approach; it helps keep Istio stable for the core developers, and provides a great deal of operational and development flexibility for adapter developers.
If you don't have the necessary environment to write a sample in process adapter, or want to try out one of the existing third party adapters, use this exercise to do so! Most of the commercial metrics vendors in the adapter list offer free trials, or free account levels.
Disclosure - I work for one of these commercial vendors, and have expertise there, but am here to help you regardless of which vendor you might choose.
gRPC Based Adapters (the preferred new approach):
In Process Adapters (legacy approach)
Take a look at the gRPC based sample adapter output; request latency is available, along with the response code for the requests.
phred@harpua ~/go/src/istio.io/istio/mixer/adapter/mygrpcadapter $ cat out.txt
HandleMetric invoked with:
Adapter config: &Params{FilePath:out.txt,}
Instances: 'i1metric.instance.istio-system':
{
Value = 1259
Dimensions = map[response_code:200]
}
HandleMetric invoked with:
Adapter config: &Params{FilePath:out.txt,}
Instances: 'i1metric.instance.istio-system':
{
Value = 1652
Dimensions = map[response_code:200]
}