Go
Package to import
zPages in Go can be enabled by importing package:
"go.opencensus.io/zpages"
and then passing an http.ServerMux to zpages.Handle and then finally servicing HTTP traffic using the mux.
Source code sample
You can enable zPages in your application by following the pattern below:
package main
import (
"log"
"net/http"
"go.opencensus.io/zpages"
)
func main() {
mux := http.NewServeMux()
zpages.Handle(mux, "/debug")
// Change the address as needed
addr := ":8888"
if err := http.ListenAndServe(addr, mux); err != nil {
log.Fatalf("Failed to serve zPages")
}
}
Rpcz
On visiting http://localhost:8888/debug/rpcz
Tracez
On visiting http://localhost:8888/debug/tracez
- With errors shown
References
Resource | URL |
---|---|
zPages Godoc | https://godoc.org/go.opencensus.io/zpages |