README
¶
Logs
enable debug logs with
curl -XPUT -d '{"level":"debug"}' -H"content-type: application/json" http://localhost:9091/logging
zPages
see them here:
localhost:9091/zpages/tracez
Local Prometheus
Start like so:
cat <<EOF > config.yaml
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
# A scrape configuration containing exactly one endpoint to scrape:
scrape_configs:
# The job name is added as a label 'job=<job_name>' to any timeseries scraped from this config.
- job_name: 'go-utils'
# Override the global default and scrape targets from this job every 1 seconds.
scrape_interval: 1s
static_configs:
- targets: ['localhost:9091']
EOF
prometheus --config.file=./config.yaml
Prometheus will be available in localhost:9090
.
To see the rate of incoming snapshots, try this query:
rate(api_snap_emitter_snap_in[5m])
Profiling
CPU tracing
$ curl http://localhost:9091/debug/pprof/trace?seconds=5 -o trace.out
$ go tool trace trace.out
profiling
$ curl http://localhost:9091/debug/pprof/profile?seconds=5 -o pprof.out
$ go tool pprof pprof.out
(pprof) top
(pprof) web
Stack traces
See go routines:
$ curl http://localhost:9091/debug/pprof/goroutine?debug=2
Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
MNumGoRoutines = stats.Int64("runtime/goroutines", "The number of goroutines", "1")
GoroutinesNumView = &view.View{
Name: "runtime/goroutines",
Measure: MNumGoRoutines,
Description: "The number of goroutines",
Aggregation: view.Sum(),
}
)
Functions ¶
func RunGoroutineStat ¶
func RunGoroutineStat()
func StartStatsServer ¶
func StartStatsServer(addhandlers ...func(mux *http.ServeMux, profiles map[string]string))
func StartStatsServerWithPort ¶
func StartStatsServerWithPort(port string, addhandlers ...func(mux *http.ServeMux, profiles map[string]string))
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.