mirror of
https://github.com/fatedier/frp.git
synced 2026-10-20 11:13:27 +08:00
feat: add metricsServer for health checks, metrics and pprof (#5578)
Add a separate HTTP listener for observability, configured through metricsServer in both frps and frpc. It serves /healthz and, when pprofEnable is set, the pprof handlers except /debug/pprof/cmdline. It never serves the dashboard, static assets or the admin API, and it does not touch the global assets filesystem. frps also serves /metrics on this listener with both runtime and business metrics, enabled by metricsServer.port alone. The in-memory collector still starts only with the dashboard, and the Prometheus collector starts either with metricsServer or with enablePrometheus plus webServer, so a configuration that collected nothing before still collects nothing. The /healthz, /metrics and pprof endpoints on webServer, and enablePrometheus, keep working but are deprecated and log a hint at startup. frpc does not serve /metrics yet.
This commit is contained in:
@@ -75,13 +75,27 @@ webServer.password = "admin"
|
||||
# dashboard assets directory(only for debug mode)
|
||||
# webServer.assetsDir = "./static"
|
||||
|
||||
# Deprecated: use metricsServer.pprofEnable for authenticated profiling.
|
||||
# Enable golang pprof handlers in dashboard listener.
|
||||
# Dashboard port must be set first
|
||||
webServer.pprofEnable = false
|
||||
|
||||
# enablePrometheus will export prometheus metrics on webServer in /metrics api.
|
||||
# Deprecated: enablePrometheus exports /metrics on webServer only.
|
||||
# Use metricsServer.port instead; it enables business metrics automatically.
|
||||
enablePrometheus = true
|
||||
|
||||
# Separate health, Prometheus metrics, and optional profiling listener.
|
||||
# Port 0 disables it. The default address only accepts local connections.
|
||||
metricsServer.addr = "127.0.0.1"
|
||||
metricsServer.port = 0
|
||||
# Credentials and TLS are independent of webServer; /healthz stays anonymous.
|
||||
# metricsServer.user = "monitor"
|
||||
# metricsServer.password = "change-me"
|
||||
# metricsServer.tls.certFile = "metrics.crt"
|
||||
# metricsServer.tls.keyFile = "metrics.key"
|
||||
# Profiling requires explicit opt-in, uses the above credentials, and excludes cmdline.
|
||||
metricsServer.pprofEnable = false
|
||||
|
||||
# console or real logFile path like ./frps.log
|
||||
log.to = "./frps.log"
|
||||
# trace, debug, info, warn, error
|
||||
|
||||
Reference in New Issue
Block a user