[PR #1589] [CLOSED] WIP: Implement API /metrics (#1357) #4412

Closed
opened 2026-05-05 14:41:35 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fatedier/frp/pull/1589
Author: @zyfdegh
Created: 1/3/2020
Status: Closed

Base: masterHead: zyfdegh/iss-1357


📝 Commits (1)

📊 Changes

6 files changed (+74 additions, -0 deletions)

View changed files

📝 cmd/frps/root.go (+3 -0)
📝 conf/frps_full.ini (+3 -0)
📝 go.mod (+1 -0)
📝 models/config/server_common.go (+7 -0)
📝 server/service.go (+6 -0)
server/stats/metrics.go (+54 -0)

📄 Description

@fatedier Hi, I've drafted an example on how to expose /metrics API in frps. Please take a look and I'm willing to make more pushes.

$ cd cmd/frps && go build
$ ./frps --enable-metrics
2020/01/03 15:57:08 [I] [service.go:152] frps tcp listen on 0.0.0.0:7000
2020/01/03 15:57:08 [I] [service.go:260] Metrics server listen on 8080
2020/01/03 15:57:08 [I] [root.go:209] start frps success

Then client_counts in GET /api/serverinfo will be shown as Prometheus server

$ curl localhost:8080/metrics
# TYPE frps_info_client_counts counter
frps_info_client_counts 0
# HELP frps_info_timestamp unix nanosec timestamp the data is collected
# TYPE frps_info_timestamp counter
frps_info_timestamp 6.312147063104991e+18
...

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fatedier/frp/pull/1589 **Author:** [@zyfdegh](https://github.com/zyfdegh) **Created:** 1/3/2020 **Status:** ❌ Closed **Base:** `master` ← **Head:** `zyfdegh/iss-1357` --- ### 📝 Commits (1) - [`2477dc0`](https://github.com/fatedier/frp/commit/2477dc08ec02674ff4a1d6556e7c73014c85c917) implement API /metrics (#1357) ### 📊 Changes **6 files changed** (+74 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `cmd/frps/root.go` (+3 -0) 📝 `conf/frps_full.ini` (+3 -0) 📝 `go.mod` (+1 -0) 📝 `models/config/server_common.go` (+7 -0) 📝 `server/service.go` (+6 -0) ➕ `server/stats/metrics.go` (+54 -0) </details> ### 📄 Description @fatedier Hi, I've drafted an example on how to expose `/metrics` API in frps. Please take a look and I'm willing to make more pushes. ```sh $ cd cmd/frps && go build $ ./frps --enable-metrics 2020/01/03 15:57:08 [I] [service.go:152] frps tcp listen on 0.0.0.0:7000 2020/01/03 15:57:08 [I] [service.go:260] Metrics server listen on 8080 2020/01/03 15:57:08 [I] [root.go:209] start frps success ``` Then `client_counts` in `GET /api/serverinfo` will be shown as Prometheus server ```text $ curl localhost:8080/metrics # TYPE frps_info_client_counts counter frps_info_client_counts 0 # HELP frps_info_timestamp unix nanosec timestamp the data is collected # TYPE frps_info_timestamp counter frps_info_timestamp 6.312147063104991e+18 ... ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 14:41:35 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#4412
No description provided.