<p>Istio has several default metrics, such as <code>istio_requests_total</code>, <code>istio_request_bytes</code>, <code>istio_tcp_connections_opened_total</code>. Istio envoy proxy computes and exposes these metrics. On the <a href="https://istio.io/docs/reference/config/telemetry/metrics/" rel="nofollow noreferrer">Istio website</a>, it shows that <code>istio_requests_total</code> is a COUNTER incremented for every request handled by an Istio proxy. </p>

<p>We made some experiments where we let a lot of requests go through the Istio envoy to reach a microservice behind Istio envoy, and at the same time we monitored the metric from Istio envoy. However, we found that <code>istio_requests_total</code> does not include the requests that have got through Istio envoy to the backend microservice but their responses have not arrived at Istio envoy from the backend microservice. In other words, <code>istio_requests_total</code> only includes the number of served requests, and does not include the requests in flight.</p>

<p>My question is: is our observation right? Why does <code>istio_requests_total</code> not include the requests in flight?</p>

Jeffrey
<p>As mentioned <a href="https://banzaicloud.com/blog/istio-telemetry/" rel="nofollow noreferrer">here</a></p>
<blockquote>
<p>The default metrics are standard information about HTTP, gRPC and TCP requests and responses. Every request is reported by the source proxy and the destination proxy as well and these can provide a different view on the traffic. Some requests may not be reported by the destination (if the request didn't reach the destination at all), but some labels (like connection_security_policy) are only available on the destination side. Here are some of the most important HTTP metrics:</p>
<p><strong>istio_requests_total is a COUNTER that aggregates request totals between Kubernetes workloads, and groups them by response codes, response flags and security policy.</strong></p>
</blockquote>
<hr />
<p>As mentioned <a href="https://www.datadoghq.com/blog/istio-metrics/#istio-mesh-metrics" rel="nofollow noreferrer">here</a></p>
<blockquote>
<p>When Mixer collects metrics from Envoy, it assigns dimensions that downstream backends can use for grouping and filtering. In Istio’s default configuration, dimensions include attributes that indicate where in your cluster a request is traveling, such as the name of the origin and destination service. This gives you visibility into traffic anywhere in your cluster.</p>
</blockquote>
<hr />
<blockquote>
<p>Metric to watch: requests_total</p>
<p>The request count metric indicates the overall throughput of requests between services in your mesh, and increments whenever an Envoy sidecar receives an HTTP or gRPC request. You can track this metric by both origin and destination service. If the count of requests between one service and another has plummeted, either the origin has stopped sending requests or the destination has failed to handle them. In this case, you should check for a misconfiguration in Pilot, the Istio component that routes traffic between services. If there’s a rise in demand, you can correlate this metric with increases in resource metrics like CPU utilization, and ensure that your system resources are scaled correctly.</p>
</blockquote>
<hr />
<p>Maybe it's worth to check envoy docs about that, because of what's written <a href="https://istio.io/docs/examples/microservices-istio/logs-istio/" rel="nofollow noreferrer">here</a></p>
<blockquote>
<p>The queries above use the istio_requests_total metric, which is a standard Istio metric. You can observe other metrics, in particular, the ones of Envoy (Envoy is the sidecar proxy of Istio). You can see the collected metrics in the insert metric at cursor drop-down menu.</p>
</blockquote>
<hr />
<p>Based on above docs I agree with that what @Joel mentioned in comments</p>
<blockquote>
<p>I think you're correct, and I imagine the &quot;why&quot; is because of response flags that are expected to be found on the metric labels. <strong>This can be written only when a response is received</strong>. If they wanted to do differently, I guess it would mean having 2 different counters, one for request sent and one for response received.</p>
</blockquote>
