Skip to content

Commit

Permalink
Add the hostname field for report api (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
mstmdev authored Jan 13, 2023
1 parent fcd06fc commit 89884b0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 2 additions & 0 deletions report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type Report struct {
Pid int `json:"pid"`
// PPid returns the process id of the caller's parent
PPid int `json:"ppid"`
// Hostname returns the host name reported by the kernel
Hostname string `json:"hostname"`
// GOOS is the running program's operating system target
GOOS string `json:"go_os"`
// GOARCH is the running program's architecture target
Expand Down
1 change: 1 addition & 0 deletions report/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func initGlobalReporter() {
},
}
report.Events, _ = toplist.New(100)
report.Hostname, _ = os.Hostname()
GlobalReporter = &Reporter{
report: report,
}
Expand Down
26 changes: 14 additions & 12 deletions server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

## API List

| Name | Route | Method | Remark |
|-----------------------------------|----------------|-----------|--------------|
| Navigation Page | / | GET | |
| Login Page | /login/index | GET | |
| User Sign In API | /signin | POST | |
| Source File Server | /source/ | GET | |
| DestPath File Server | /dest/ | GET | |
| [File Query API](#file-query-api) | /query | GET | |
| [File Push API](#file-push-api) | /w/push | POST | |
| PProf API | /manage/pprof | GET | |
| Config API | /manage/config | GET | |
| [Report API](#report-api) | /manage/report | GET | |
| Name | Route | Method | Remark |
|-----------------------------------|----------------|--------|--------|
| Navigation Page | / | GET | |
| Login Page | /login/index | GET | |
| User Sign In API | /signin | POST | |
| Source File Server | /source/ | GET | |
| DestPath File Server | /dest/ | GET | |
| [File Query API](#file-query-api) | /query | GET | |
| [File Push API](#file-push-api) | /w/push | POST | |
| PProf API | /manage/pprof | GET | |
| Config API | /manage/config | GET | |
| [Report API](#report-api) | /manage/report | GET | |

### File Query API

Expand Down Expand Up @@ -269,6 +269,7 @@ Response field description:
- `up_time` returns the server up time
- `pid` returns the process id of the caller
- `ppid` returns the process id of the caller's parent
- `hostname` returns the host name reported by the kernel
- `go_os` is the running program's operating system target
- `go_arch` is the running program's architecture target
- `go_version` returns the Go tree's version string
Expand Down Expand Up @@ -307,6 +308,7 @@ Here is an example response:
"up_time": "36m31s",
"pid": 94032,
"ppid": 9268,
"hostname": "no-src",
"go_os": "windows",
"go_arch": "amd64",
"go_version": "go1.18",
Expand Down

0 comments on commit 89884b0

Please sign in to comment.