https://github.com/awbraunstein/zpages
Go utilities for generating helpful debug and internal pages for server inspection.
https://github.com/awbraunstein/zpages
debugging go infrastructure server tools webserver
Last synced: 5 months ago
JSON representation
Go utilities for generating helpful debug and internal pages for server inspection.
- Host: GitHub
- URL: https://github.com/awbraunstein/zpages
- Owner: awbraunstein
- License: mit
- Created: 2019-02-27T18:15:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-02T01:43:18.000Z (over 7 years ago)
- Last Synced: 2024-06-20T15:58:12.865Z (about 2 years ago)
- Topics: debugging, go, infrastructure, server, tools, webserver
- Language: Go
- Size: 15 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zpages
[](LICENSE)
[](https://godoc.org/github.com/awbraunstein/zpages)
[](https://travis-ci.org/awbraunstein/zpages)
[](https://codecov.io/gh/awbraunstein/zpages)
[](https://goreportcard.com/report/github.com/awbraunstein/zpages)
Go utilities for generating helpful debug and internal pages for server inspection. Works out of the box with `net/http` based web servers.
## Installation
`go get -u github.com/awbraunstein/zpages`
## Usage
Just add the handlers/middleware that you want and run your server. It is recommended to put these pages behind some sort of internal auth to avoid leaking this information to users.
```golang
func main() {
mux := http.NewServeMux()
requestzHandler, err := zpages.NewRequestz()
if err != nil {
log.Fatalf("Unable to initialize Requestz handler; err=%v", err)
}
mux.Handle("/healthz", requestzHandler.Middleware(zpages.NewHealthz()))
statuszHandler, err := zpages.NewStatusz()
if err != nil {
log.Fatalf("Unable to initialize Statusz handler; err=%v", err)
}
mux.Handle("/statusz", requestzHandler.Middleware(statuszHandler))
mux.Handle("/requestz", requestzHandler.Middleware(requestzHandler))
log.Println("Listening on %s...", *httpAddr)
http.ListenAndServe(":8080", mux)
}
```