diff --git a/README.md b/README.md index ac4f932..cde5553 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,7 @@ Proxy Server: AWS US West Oregon (us-west-2) "password": "yubiyubi" } }, + "prometheus_listen": ":8080", // Prometheus HTTP metrics server listen address (at /metrics) "recv_window_conn": 33554432, // QUIC stream receive window "recv_window_client": 67108864, // QUIC connection receive window "max_conn_client": 4096 // Max concurrent connections per client @@ -172,6 +173,21 @@ The endpoint must return results with HTTP status code 200 (even if the authenti } ``` +#### Prometheus Metrics + +You can make Hysteria expose a Prometheus HTTP client endpoint for monitoring traffic usage with `prometheus_listen`. +If configured on port 8080, the endpoint would be at `http://example.com:8080/metrics`. + +```text +hysteria_traffic_downlink_bytes_total{auth="55m95auW5oCq"} 122639 +hysteria_traffic_downlink_bytes_total{auth="aGFja2VyISE="} 3.225058e+06 + +hysteria_traffic_uplink_bytes_total{auth="55m95auW5oCq"} 40710 +hysteria_traffic_uplink_bytes_total{auth="aGFja2VyISE="} 37452 +``` + +`auth` is the auth payload sent by the clients, encoded in Base64. + ### Client ```json5 diff --git a/README.zh.md b/README.zh.md index 1ba74a6..198ed29 100644 --- a/README.zh.md +++ b/README.zh.md @@ -160,6 +160,21 @@ Hysteria 是专门针对恶劣网络环境(常见于卫星网络、在中国 } ``` +#### Prometheus 流量统计 + +通过 `prometheus_listen` 选项可以让 Hysteria 暴露一个 Prometheus HTTP 客户端 endpoint 用来统计流量使用情况。 +例如如果配置在 8080 端口,则 API 地址是 `http://example.com:8080/metrics` + +```text +hysteria_traffic_downlink_bytes_total{auth="55m95auW5oCq"} 122639 +hysteria_traffic_downlink_bytes_total{auth="aGFja2VyISE="} 3.225058e+06 + +hysteria_traffic_uplink_bytes_total{auth="55m95auW5oCq"} 40710 +hysteria_traffic_uplink_bytes_total{auth="aGFja2VyISE="} 37452 +``` + +`auth` 是客户端发来的验证密钥,经过 Base64 编码。 + ### 客户端 ```json5