tldr: you cannot do this.
Now the long answer.
From istio documentnion about metrics:
For HTTP, HTTP/2, and GRPC traffic, Istio generates the following
metrics:
Request Count (istio_requests_total): This is a COUNTER incremented
for every request handled by an Istio proxy.
. . .
For TCP traffic, Istio generates the following metrics:
Tcp Byte Sent (istio_tcp_sent_bytes_total): This is a COUNTER which
measures the size of total bytes sent during response in case of a TCP
connection.
Tcp Byte Received (istio_tcp_received_bytes_total): This is a COUNTER
which measures the size of total bytes received during request in case
of a TCP connection.
Tcp Connections Opened (istio_tcp_connections_opened_total): This is a
COUNTER incremented for every opened connection.
Tcp Connections Closed (istio_tcp_connections_closed_total): This is a
COUNTER incremented for every closed connection.
. . .
Notice that istio_requests_total (according to documentation) counts number of requests and this metric is available only for HTTP, HTTP/2, and GRPC traffic.
For TCP traffic there is no requests_total mertic because it would be hard to say what to define as a request. That is why for tcp you can only count bytes and
number of connections.
Now you may say: "hey, I am not using tcp, I am using https (http over tls) so it should be able to count the requests, right?" - and you would be wrong.
Before I go further, let me first mention about "HTTP persistent connection" which is defined by wikipedia as:
HTTP persistent connection, also called HTTP keep-alive, or HTTP
connection reuse, is the idea of using a single TCP connection to send
and receive multiple HTTP requests/responses, as opposed to opening a
new connection for every single request/response pair. The newer
HTTP/2 protocol uses the same idea and takes it further to allow
multiple concurrent requests/responses to be multiplexed over a single
connection.
Now, why am I mentioning this?
TLS is encrypted traffic. Nothing can peek inside. In case your application is sending/receiving multiple requests/responses over single tls connection (using HTTP persistent connection), it's impossible to count every consecutive
request because it is end-to-end encrypted.