envoyproxy / gateway

Manages Envoy Proxy as a Standalone or Kubernetes-based Application Gateway
https://gateway.envoyproxy.io
Apache License 2.0
1.49k stars 320 forks source link

Enriching the Prometheus metric labels emitted by Envoy from HCM/TcpProxy StatPrefix #3160

Closed shuji-2019 closed 3 weeks ago

shuji-2019 commented 4 months ago

Description:

Currently HCM ^1 StatPrefix ^3 can be http or https, TcpProxy ^2 StatPrefix ^4 can be tcp, passthrough or terminate. That maybe not enough for production usage.

Because it's common to deploy many listeners for different domains, even serve multiple domains by single listener in which domains are distinguished via FilterChainMatch.SNI ^5. If all listeners share the same StatPrefix, it's difficult to tell how many traffic does specified domain have received. Consider sample from Envoy's /stats/prometheus.

# TYPE envoy_listener_http_downstream_rq_completed counter
envoy_listener_http_downstream_rq_completed{envoy_http_conn_manager_prefix="https",envoy_listener_address="0.0.0.0_8080"} 0
envoy_listener_http_downstream_rq_completed{envoy_http_conn_manager_prefix="https",envoy_listener_address="0.0.0.0_8081"} 0
envoy_listener_http_downstream_rq_completed{envoy_http_conn_manager_prefix="https",envoy_listener_address="0.0.0.0_8082"} 0
envoy_listener_http_downstream_rq_completed{envoy_http_conn_manager_prefix="https",envoy_listener_address="0.0.0.0_8083"} 0
envoy_listener_http_downstream_rq_completed{envoy_http_conn_manager_prefix="http",envoy_listener_address="0.0.0.0_8084"} 1
envoy_listener_http_downstream_rq_completed{envoy_http_conn_manager_prefix="http",envoy_listener_address="0.0.0.0_8085"} 6
envoy_listener_http_downstream_rq_completed{envoy_http_conn_manager_prefix="http",envoy_listener_address="0.0.0.0_8086"} 0
envoy_listener_http_downstream_rq_completed{envoy_http_conn_manager_prefix="http",envoy_listener_address="0.0.0.0_8087"} 0
envoy_listener_http_downstream_rq_completed{envoy_http_conn_manager_prefix="https",envoy_listener_address="0.0.0.0_7021"} 0
envoy_listener_http_downstream_rq_completed{envoy_http_conn_manager_prefix="https",envoy_listener_address="0.0.0.0_8088"} 0

Relevant Links:

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days.

arkodg commented 3 months ago

@shuji-2019 would https://github.com/envoyproxy/gateway/issues/3318 solve this use case ?

aoledk commented 3 months ago

@shuji-2019 would #3318 solve this use case ?

3318 can't solve this use case.

To solve this use case, meaningful stat_prefix should be set for HCM ^1 or TCPProxy ^2. Like which hostname or port does the HCM or TCPProxy is serving for.

BTW, shuji-2019 is me and that account is abandoned.

arkodg commented 3 months ago

there may be multiple hostnames per hcm

aoledk commented 3 months ago
github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days.

github-actions[bot] commented 3 weeks ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days.

shawnh2 commented 3 weeks ago

can this be closed ?

aoledk commented 3 weeks ago

can this be closed ?

It's fine to close this.