solo-io / gloo

The Cloud-Native API Gateway and AI Gateway
https://docs.solo.io/
Apache License 2.0
4.1k stars 446 forks source link

Add tcp stats flag to ListenerOptions API. #10281

Closed bleggett closed 4 days ago

bleggett commented 1 week ago

Description

Adds support for wrapping Envoy listener transport sockets with the tcp_stats transport socket.

This allows Envoys stats endpoint to capture and report Linux-level TCP stats for a given listener, which can help with debugging:

ex:

listener.0.0.0.0_8082.tcp_stats.cx_rx_bytes_received: 234
listener.0.0.0.0_8082.tcp_stats.cx_rx_data_segments: 3
listener.0.0.0.0_8082.tcp_stats.cx_rx_segments: 15
listener.0.0.0.0_8082.tcp_stats.cx_tx_bytes_sent: 291
listener.0.0.0.0_8082.tcp_stats.cx_tx_data_segments: 3
listener.0.0.0.0_8082.tcp_stats.cx_tx_retransmitted_segments: 0
listener.0.0.0.0_8082.tcp_stats.cx_tx_segments: 6
listener.0.0.0.0_8082.tcp_stats.cx_tx_unacked_segments: 0
listener.0.0.0.0_8082.tcp_stats.cx_tx_unsent_bytes: 0
listener.0.0.0.0_8082.tcp_stats.cx_rtt_us: B0.5(0,0) B1(0,0) B5(0,0) B10(0,0) B25(0,3) B50(0,3) B100(0,3) B250(0,3) B500(0,3) B1000(0,3) B2500(0,3) B5000(0,3) B10000(0,3) B30000(0,3) B60000(0,3) B300000(0,3) B600000(0,3) B1.8e+06(0,3) B3.6e+06(0,3)
listener.0.0.0.0_8082.tcp_stats.cx_rtt_variance_us: B0.5(0,0) B1(0,0) B5(0,0) B10(0,3) B25(0,3) B50(0,3) B100(0,3) B250(0,3) B500(0,3) B1000(0,3) B2500(0,3) B5000(0,3) B10000(0,3) B30000(0,3) B60000(0,3) B300000(0,3) B600000(0,3) B1.8e+06(0,3) B3.6e+06(0,3)
listener.0.0.0.0_8082.tcp_stats.cx_tx_percent_retransmitted_segments: B0.5(0,3) B1(0,3) B5(0,3) B10(0,3) B25(0,3) B50(0,3) B100(0,3) B250(0,3) B500(0,3) B1000(0,3) B2500(0,3) B5000(0,3) B10000(0,3) B30000(0,3) B60000(0,3) B300000(0,3) B600000(0,3) B1.8e+06(0,3) B3.6e+06(0,3)

This is roughly analogous to the proxy_protocol transport socket wrapping we already support for clusters.

Note also that we should probably do this for clusters as well as listeners, but for now this is just adding listener support via the ListenerOptions API.

API changes

adds listenerTcpStats: true|false to the ListenerOptions API.

Checklist:

github-actions[bot] commented 1 week ago

Visit the preview URL for this PR (updated for commit 6b049df):

https://gloo-edge--pr10281-bleggett-add-tcp-sta-5ko6txmd.web.app

(expires Fri, 15 Nov 2024 20:18:09 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 77c2b86e287749579b7ff9cadb81e099042ef677

solo-changelog-bot[bot] commented 1 week ago

Issues linked to changelog: https://github.com/solo-io/solo-projects/issues/7176

bleggett commented 5 days ago

Yay flake. Waiting for https://github.com/solo-io/solo-projects/pull/7184 anyway.

bleggett commented 4 days ago

/kick-ci

sam-heilbron commented 4 days ago

/test