How to Do Request Statistics with Istio Virtual Service?

Viewed 100

We have a service running behind istio virtual service. Occasionally the request timeouts at the client side while everything is normal inside the service.

To solve this problem, we want to record time cost for all queries, and use these data to check time cost for specific query (by specifying filter fields included in the query) when timeouts happen again.

Best way to do that is using something like plugin with istio virtual service. But seems istio not provide such thing. How to do that?

software info
istio v1.14
kubernetes v1.20

2 Answers

You can check the istio standard metrics and istio with prometheus integration.

https://istio.io/latest/docs/reference/config/metrics/#:~:text=For%20HTTP%2C%20HTTP%2F2%2C,measures%20the%20duration%20of%20requests

Standard metrics will be helpful to found the timeout issue, latency and other details between service to service communication and ingress to service also if exposed.

You can get P50, P90 and other metrics. enter image description here

I would recommend checking out and installing istio and it's service dashboard : https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengistio-intro-topic.htm

Also tracing might be helpful to check the request tracing and time it's taken to process.

https://istio.io/latest/docs/tasks/observability/distributed-tracing/jaeger/

The idiomatic way to gather metrics in Kubernetes is to use Prometheus. You can then view statistics in various different ways using PromQL.

The statistics you can gather depends on what are exposed by the services that are scraped. Ingress controllers (istio/kong/etc.) will always expose stuff like latencies to upstream services, time taken by the controllers, time taken by the upstream, etc.

Another method, not by using statictics, but might be useful for debugging your problem, is to use Kiali to visualize how every request is passed through every microservice in the cluster.

Related